I have Launch4J on my computer and it's a great program. One of its features I'm interested in is the ability to bundle a JRE in the general .EXE file. However, I can't find any documentation that describes how to go about doing this.
How do I bundle a JRE with the EXE? Plus, where do I get a compact, portable JRE to run? The download links on Oracle are for the installer packages.
You can create install4j JRE bundles from installed JREs by invoking Project->Create a JRE Bundle from the main menu or by using the createbundle command line utility. It is not possible to directly convert a ZIP with a JRE or an archive downloaded from the Oracle web site into a JRE bundle that is usable by install4j.
Here you can select a JRE to be bundled with your application. The JRE files will be excluded from the builds if this option is not being used. This is a very useful option for a Java application, which allows you to reduce the installation requirements of your package.
After some attempts i finally get a workaround to bundle the jre in my application:
I package my app as a zip file with the following folders inside:
containerFolder |- jre |-bin (in bin there is java.exe) |-lib |- cfg (to save the user configuration, but it's not needed) |- bin (my application with the .exe and the .jar and all the other stuff)
In the xml file of launch4j i configure the jre like this:
<jre> <path>../jre</path> <opt>-DgvSIG.confDir=../cfg</opt> </jre>
The trick here is that the path is not to the java.exe file. The path to the jre is relative to the position of the .exe and it should point to one folder before the java.exe file
The jre folder i'm using is just a copy&paste from the jre folder installed on a windows system.
I did the following and it worked for me using ver Launch4j 3.11:
In the Launch4j having set all the required options, then set the Bundled JRE path to "jre"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With