5

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.

Umdoobby
  • 105
  • 1
  • 5
  • 11

2 Answers2

3

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.)

Jean Waghetti
  • 4,711
  • 1
  • 18
  • 28
  • it did show him that but he is lucky he knows how to turn the computer on, I though giving him the program was a good idea. The ultimate test of usability, the whole "go here to download and install the JRE" this was a bit too advanced for him I mean most people don't even know how to start a program they just go for the pretty picture on the desktop. and I would like to avoid making someone install the program, its only one file, i think an installer is overkill – Umdoobby Mar 14 '13 at 15:09
  • I think the way is to provide an installer with NSIS, for example, then. You can search for Java in Windows registries, run the bundled installer of Java if you doesn't find one, and install your application. But don't forget to create an uninstaller! – Jean Waghetti Mar 14 '13 at 15:11
  • I will keep that in mind going back to what you said originally; if I were to put the path C:\...\jre\bin in the bundle option, does it take all of the files needed to run the Jar and puts them in with the Exe so it is more autonomous – Umdoobby Mar 14 '13 at 15:20
  • 1
    But if there is a JRE installed on C:, launch4j would have find it automatically. A bundled JRE is, mainly, for cases where a custom JRE is necessary. In the case of your friend, there is no Java installed. launch4j didn't find one and provided the link to download it (I guess). The options are: 1) manually install Java. 2) follow launch4j link and install java (this is manual too). 3) provide a complete JRE alongside with your jar. 4) create and installer that installs your program and has JRE installer too. Maybe there are another options, but I would go with one of these four. – Jean Waghetti Mar 14 '13 at 15:26
  • @Jean Waghetti, for option 3, the complete jre have a very big sizes (100+-). do you use all of the jre file or just using few only. if few file inside jre only, which one should we take? – Ridzuan Adris May 16 '14 at 02:09
  • I have not tried it, but take a look at this question: http://stackoverflow.com/questions/4387266/reducing-size-of-jre or you can bundle another JRE compatible with you application. – Jean Waghetti May 16 '14 at 16:23
1

I have created my own version of the launch4j that allows downloading and installing of required JRE automatically. If you want to give it a try, get it here: https://github.com/maztan/launch4j_auto_jre_download . After running the launch4j, set the options in the "JRE" tab.

ed22
  • 1,127
  • 2
  • 14
  • 30