GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing javaevolved.dev — Multi-file source launcher | java.evolved
Tooling
Intermediate
Multi-file source launcherLaunch multi-file programs without an explicit compile step. Code Comparison
✕ 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
See a problem with this code? Let us know.
Why the modern way wins
🚀
Zero setupNo build tool needed for small multi-file programs. 🔗
Auto-resolveReferenced classes are found and compiled automatically. 📝
Script-likeRun multi-file programs like scripts. Old Approach
Compile All First
Modern Approach
Source Launcher
Since JDK
22
Difficulty
Intermediate
JDK Support
Multi-file source launcher
Available
Available since JDK 22 (March 2024) How it works
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. Related Documentation
Related patterns
Tooling
Advanced
Compact object headersJava 8
// Default: 128-bit object header // = 16 bytes overhead per object // A boolean field object = 32 bytes! // Mark word (64) + Klass pointer (64) Java 25
// -XX:+UseCompactObjectHeaders // 64-bit object header // = 8 bytes overhead per object // 50% less header memory // More objects fit in cache
JDK 25+
→
Tooling
Advanced
AOT class preloadingJava 8
// Every startup: // - Load 10,000+ classes // - Verify bytecode // - JIT compile hot paths // Startup: 2-5 seconds Java 25
// Training run:
$ java -XX:AOTCacheOutput=app.aot \
-cp app.jar com.App
// Production:
$ java -XX:AOTCache=app.aot \
-cp app.jar com.App
JDK 25+
→
Tooling
Beginner
JShell for prototypingJava 8
// 1. Create Test.java // 2. javac Test.java // 3. java Test // Just to test one expression! Java 9+
$ jshell jshell> "hello".chars().count() $1 ==> 5 jshell> List.of(1,2,3).reversed() $2 ==> [3, 2, 1]
JDK 9+
→
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |