Distributing Custom Runtime Images
What you'll learn: How to package and deploy self-contained Java applications that run without requiring users to install a separate JRE.
The Core Idea
After creating a custom runtime image with jlink, you need to distribute it to end users. The beauty of this approach is that your application becomes completely self-contained—users don't need Java installed on their machines. You're shipping your application with its own minimal JRE baked in.
Think of it like the difference between sending someone a recipe (requiring them to have a kitchen) versus delivering a fully-prepared meal in an insulated container. Your custom runtime image is the meal—everything needed is already included.
Distribution Mechanics
A jlink-generated runtime image is simply a directory structure containing:
- Your application modules
- Only the JDK modules your app requires
- Native executables (like
javaand your custom launcher) - Supporting libraries and configuration files
To distribute it:
- Compress the directory: Zip, tar.gz, or platform-specific installers work fine
- Ship it: Users extract and run—no JRE installation needed
- Platform-specific builds: Create separate images for Windows, macOS, and Linux since native binaries differ
Key Benefits for Distribution
- Simplified deployment: No "Do you have Java installed?" questions
- Version control: Your app always runs on the exact Java version you tested
- Smaller footprint: Only necessary modules included, not a full JDK
- Professional packaging: Combine with installer tools (like jpackage) for native installers
Key Takeaway: Custom runtime images let you distribute Java applications as self-contained packages that run immediately on user machines without any Java installation prerequisite, solving one of Java's historic deployment challenges.