You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to share one jre in a system with many sub modules? #483
JavaPackager use launch4j to generate exe package, but can not pass configuration of launch4j to JavaPackager. if open the configuration of launch4j, this will is not a problem.
Thanks for the request! With Launch4j (the default exeCreationTool) this isn't possible today: JavaPackager builds the Launch4j config itself and the JRE path is either the bundled one or %JAVA_HOME%;%PATH%.
It is possible with the Why launcher, overriding its config template. I've just tested this on Windows with 2.0.0-rc1:
In each module, set exeCreationTool to why and bundleJre to false:
Use forward slashes (../jre): with ..\jre Why finds the JVM but fails to start it.
Put the shared JRE in jre, next to the modules' folders. You can create it with jlink, or package one module with bundleJre=true and customizedJre=false and move its jre folder.
Keep in mind the installers won't include the shared JRE, as it's outside each app's folder, so you'd need to ship it yourself.
I'll keep this open as an enhancement: an option to point the EXE to an external JRE that works with the three Windows launchers. Would that cover your case? Do you use the installers or just the app folders?
Activity
fvarrui commentedon Oct 4, 2026
Thanks for the request! With Launch4j (the default
exeCreationTool) this isn't possible today: JavaPackager builds the Launch4j config itself and the JRE path is either the bundled one or%JAVA_HOME%;%PATH%.It is possible with the Why launcher, overriding its config template. I've just tested this on Windows with 2.0.0-rc1:
In each module, set
exeCreationTooltowhyandbundleJretofalse:Add
assets/windows/why-ini.vtlto each module (or to yourassetsDir), pointingjvm_installto the shared JRE, relative to the EXE's folder:Use forward slashes (
../jre): with..\jreWhy finds the JVM but fails to start it.Put the shared JRE in
jre, next to the modules' folders. You can create it withjlink, or package one module withbundleJre=trueandcustomizedJre=falseand move itsjrefolder.Keep in mind the installers won't include the shared JRE, as it's outside each app's folder, so you'd need to ship it yourself.
I'll keep this open as an enhancement: an option to point the EXE to an external JRE that works with the three Windows launchers. Would that cover your case? Do you use the installers or just the app folders?
Record #483 answer