Download Links

Simulate 3D | SBW (Win32) | Bifurcation Discovery | FluxBalance

Sunday, November 11, 2012

Launch4j for 32bit

Launch4j is a great project, that can bundle java applications into an executable, so that starting these applications is no longer a problem. No batch files needed, no relying that the default extension for jars is starting them and no command line wizardry required. Launch4j would allow you to either bundle a JRE with your java application, or it could find it during runtime.

There was only one catch, you could not let it know that what you do want it to find is a certain architecture of JRE. See, when your project would use JNI and your native libraries are only available in 32 bit architecture, then running the project with a 64bit JVM would just not work.

Thanks to the wonders of open source, the full code for launch4j is publicly available from SF, so it was no problem to fork the project and add an option to the launcher that would allow it to find 32 bit JVMs first.

A new installer is available on github!, grab it here:

http://fbergmann.github.com/launch4j/files/SetupLaunch4j_3.0.3.exe

Screenshot

4 comments:

miked said...

Nice work! Do you know which classes you modified so this can easily be pushed into the jars for the linux and osx builds? Maybe it isn't that simple.

Unknown said...

I encountered the problem that a bundled 32-bit JRE with the option to use only the bundled JRE will cause a crash on Win7-64 bit with a "Could not create VM" error. Does your fix also address this case?

Unknown said...

I encountered the problem that a bundled 32-bit JRE with the option to use only the bundled JRE will cause a crash on Win7-64 bit with a "Could not create VM" error. Does your fix also address this case?

Frank said...

I'm afraid that version would only address locating a systems JRE (as it addresses where it is located). If you need to bundle the JRE, i would actually always choose to bundle a 32 bit one, as that will work on both systems.