single-file source-code launcher
The java command's ability to compile a single .java file in memory and run it at once, leaving no class file behind.
In more detail
Running java Hello.java is handy for short scripts and experiments. Nothing is written to disk, so the folder still holds only source files afterwards. It stops being an option once a program has more than one source file to build, and it is not how you ship a service.
Example
java Hello.javaRelated terms
- java command — The command that starts a JVM and runs a program, given a class name, a JAR file with -jar, or a single source file.
- javac — The Java compiler command, which reads .java source files and writes one .class file per class.
Taught in
- The Lifecycle Of A Java Program — Modern Java: Virtual Threads & High-Throughput Services