B4J Question make jar file to exe file to run on windows

Didier9

Well-Known Member
Licensed User
Longtime User
Note that the built-in option requires OpenJDK. If you cannot run OpenJDK, there is a SourceForge utility called Launch4J that does a good job of packaging Oracle Java applications into a small exe (that requires the JRE).
http://launch4j.sourceforge.net/
I have been unable to run OpenJDK on my corporate laptop (for various reasons, not all well-founded, not worth dwelling into that) so I use Launch4J.
Launch4J has a bewildering array of options, which can be very intimidating.
I found I only needed to set 2 fields in the Basic tab "Output file" and "Jar" and ignore everything else (leave at default)

Once you have done that, save the configuration for next time, click on the gear icon and Bob's your uncle.

The exe will require the Oracle JRE to be installed on the target machine, but the exe is fairly small in size.

In my corporate environment, the resulting exe does not need to be "installed", which is a plus since most user machines are comprehensively locked down. It will run from anywhere that the computer can access (local drive or remote storage). The IT department needs to install the JRE one time on each target machine (and update it when necessary) but from that point on, I can release new copies of the exe without further interaction with IT.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…