Compile and run
javac, java, and the modern single-file launch.
From source to output
The classic two-step build:
javac Hello.java # compile → produces Hello.class
java Hello # run → JVM executes Hello.class
Note you run java Hello — the class name, with no .class extension and no path tricks. The JVM finds Hello.class on the classpath and invokes its main.
Since Java 11 there's a shortcut for quick programs — launch a single source file directly, compiling it in memory:
java Hello.java
Great for learning and scripts. For anything bigger you'll use a build tool (Maven or Gradle), which we cover later — but underneath, it's still javac then java.