You know the drill. Write code, compile it, run it. Write code, compile it, run it. Over and over. What if you could skip the middle step entirely?
Since JDK 11, Java lets you run a source file directly — no separate javac step needed. The java launcher handles compilation behind the scenes. And as of JDK 22, this works with multi-file programs too.
Let me walk through how it works, when to use it, and where it breaks down.
Single-File Source-Code Programs
Create a file called HelloWorld.java:






