Umdoobby Umdoobby - 6 months ago 49
Java Question

How do I use the Bundle JRE option in Launch4j

I have worked with Java for a while now, long enough to start producing my own programs with GUIs and not just little sample programs from a text book that run in Eclipse. I wanted to make my programs more user friendly for the user, specifically the Windows users, by wrapping the executable Jar into an Exe. So I found Launch4j, it seems to do a pretty good job but I have no idea what over half of the options in that program mean (It took me an hour to figure out how to get it to make a functional Exe). I handed that to a fried to test and he returned to me saying that he was getting the no JRE found error. Well I wondered how I can force the end users to have the JRE then I noticed the bundle JRE option in Launch4j. But how do I use it? Do I download the JRE offline installer for Windows and it will run that if it can't find an installed one? Then what about proper version for the system (32-bit v 64-bit). I guess I was thinking I would lead it to this mysterious package containing a JRE and my wrapped program would use that to run. Just can someone please tell me how to use that function, what if anything I have to download, etc.

If Launch4j isn't the best program to do this then please recommend something else, I have only just started to get into this, for all I know there is a better wrapper out there.

Answer

Your "installation" will need an already installed JRE (with jre/bin folder with java.exe and all the other files) for a "bundled" JRE. You can't pack an Java installer with launch4j.

Doesn't it show to your friend the option to download and install Java if it doesn't find a JRE?

If you want to install Java alongside with your application, take a look at NSIS.

There's another one: IzPack. It creates multi-plataform installer. But, as it depends on Java, it's the same case of launch4j -> you'll need to download and install Java first. (I didn't use IzPack yet, but when I was looking for a solution, it was one of my alternatives.)