Tooling Średniozaawansowany

Launch multi-file programs without an explicit compile step.

✕ Java 8
$ javac *.java
$ java Main
// Must compile all files first
// Need a build tool for dependencies
✓ Java 22+
$ java Main.java
// Automatically finds and compiles
// other source files referenced
// by Main.java
Widzisz problem z tym kodem? Daj nam znać.
🚀

Zero setup

No build tool needed for small multi-file programs.

🔗

Auto-resolve

Referenced classes are found and compiled automatically.

📝

Script-like

Run multi-file programs like scripts.

Stare podejście
Compile All First
Nowoczesne podejście
Source Launcher
Od JDK
22
Poziom trudności
Średniozaawansowany
Multi-file source launcher
Dostępne

Available since JDK 22 (March 2024)

Java 22+ can automatically compile referenced source files when launching from a .java file. This makes small multi-file programs as easy to run as scripts, without needing Maven or Gradle.

Udostępnij 𝕏 🦋 in