Skip to content

Is there a way I can bundle a jre in a Launch4j .exe file?

I would like to bundle a jre folder into my generated launch4j .exe file via maven pom.xml (For some reason, I don’t want an installer, just a click to run Java application that has its own embedded jre). Is it possible? I have read through several posts and I don’t get a maven automated one. I don’t want to do it the manual way, just by packaging through maven because of some reasons

I’ve tried bundling a jre folder into an exe file via maven but it ends up not running after I uninstall java from my system or after I remove the jre folder from which the pom.xml Launch4j configuration was using . Kindly assist.



Update: I found a perfect tool for just the above task, Warp-Packer. The software just requires a few CMD commands/terminal commands to compress and add your JRE and pre-generated executable(from software like Launch4j or any of your preference) to one .EXE file which requires no installation. Click to run.

Basically, it is a simple command like:

cd %jre_folder%%jre_folder% is the path to your folder where the warp-packer.exe, JRE and pre-generated exe(in my case myapp.exe) file are. then type the following:

.warp-`packer` --arch windows-x64 --input_dir jre_folder --exec myapp.exe --output myapp.exe

The image below illustrates that

Check this example

6 People found this is helpful