โ— Shell
clean mode source โ†—

AOT class preloading

Code Comparison

// Every startup:
// - Load 10,000+ classes
// - Verify bytecode
// - JIT compile hot paths
// Startup: 2-5 seconds
// Training run:
$ java -XX:AOTCacheOutput=app.aot \
    -cp app.jar com.App
// Production:
$ java -XX:AOTCache=app.aot \
    -cp app.jar com.App

Why the modern way wins

โšก

Faster startup

Skip class loading, verification, and linking.

๐Ÿ“ฆ

Cached state

Training run captures the ideal class state.

๐Ÿ”ง

No code changes

Works with existing applications โ€” just add JVM flags.

Old Approach

Cold Start Every Time

Modern Approach

AOT Cache

JDK Support

AOT class preloading

Available

Available as a standard feature in JDK 25 LTS (JEPs 514/515, Sept 2025).

How it works

AOT class preloading caches loaded and linked classes from a training run. On subsequent starts, classes are loaded from the cache, skipping verification and linking. Combined with AOT compilation, this dramatically reduces startup time.

Related Documentation