1

Just a quick question. I want to bundle a JRE with my Java application using launch4j, but so far it is seeming that I need to bundle the application on a 64 bit machine and a 32 bit machine for some reason, as when I bundle the application as a .exe on my 64 bit machine I receive a bundled JRE error on my 32 bit machine, and vice versa. I just wondered if this was correct because I thought that a 32 bit application would still run on a 64 bit machine...

Also, I haven't tested yet and I am a newbie to OS X but does the same apply for Mac?

PS I'm bundling the JRE inside the JDK if that makes any difference

Sorry everyone, I've just realised that bundling only means that the EXE will look for the JRE in the path you defined, rather than actually packaging the JRE inside of the EXE (which I thought was the case)! Therefore, my problem was (probably) nothing to do with CPU architecture, but because I didn't copy the folder with the JRE in when I was testing. Opps! In case you wanted to know, I now just plan to add the facility to automatically download Java in the installer if it is not present on the machine.

Andy
  • 3,600
  • 12
  • 53
  • 84
  • Java class files are arch-agnostic. "generated/bundled .exe" files, however, are arch-specific. (There are clever ways to make 32/64-bit "compatible" executable, but they are beyond the scope of a comment.) –  Nov 03 '11 at 20:02
  • Andy was asking about the JREs which do have different versions. – Bill K Nov 03 '11 at 20:04
  • @pst Thanks for the answer, but I don't really think it helps – Andy Nov 03 '11 at 20:04
  • @HarryJohnston: basically, if a bundle my JAR file as an .EXE with a JRE using launch4j on a 32 bit version of windows, I receive a "bundled JRE error" on a 64 bit version of windows! (sorry for the slow reply) – Andy Nov 06 '11 at 10:10
  • Sounds like an issue specific to launch4j, then. Does the vendor have their own support site/forum? You might have better luck there. – Harry Johnston Nov 06 '11 at 21:52
  • @HarryJohnston: I'm not too sure that the issue is specific to launch4j myself, judging by Bill's answer, but I *would* contact the developer anyway. However, it is on SourceForge and the only way to obtain support is via the forum, that looks really slow and quite unresponsive, or via the SourceForge messaging thing, that doesn't seem to want to load for some reason. I may post on the forum and keep trying though... – Andy Nov 07 '11 at 20:29
  • In my launch4J setup, i will install the bundle 32-bit JRE into my application directory and asks the Launch4j launcher to refer to it `` rather than to the standard user Java installation setup path. This way, it won't interfere with global Java environment setup. It works on 64-bit Windows. – ee. Nov 17 '11 at 00:40
  • To enforce Lanuch4j to use 32-bit JRE mode, refer to: [http://stackoverflow.com/questions/2688932/configure-launch4j-to-use-32-bit-jvm-only](http://stackoverflow.com/questions/2688932/configure-launch4j-to-use-32-bit-jvm-only) – ee. Nov 17 '11 at 00:51
  • OMG What a 'numpty' I am FGS! For some reason, I was under the impression that the JRE was actually put into the EXE, but NO, apparently bundling only means "telling the application where the JRE is"! I fully admit this is my lack of knowledge, but god that's annoying! – Andy Nov 20 '11 at 17:13

1 Answers1

2

Traditionally you don't bundle the JRE for just this reason.

Also because you'll end up downgrading people's JRE install in the future.

Bill K
  • 62,186
  • 18
  • 105
  • 157
  • Not familiar with Launch4J, so I don't know if it's reasonable on that, but I *do* include a current 32-bit JRE with my thick apps. However, my installer only installs it if it's newer than the (if any) JRE on the system. I've had no problem with the 32-bit JRE on 64-bit platforms (obviously the other way around I would though). – Brian Knoblauch Nov 03 '11 at 20:08
  • Does it work if you go to a mac or Linux PC? If it gives a reasonable prompt I guess it's cool to just ship with the 32 bit system and prompt for anything else unless you absolutely need the 64 bit speed. – Bill K Nov 03 '11 at 20:11
  • Oh, that's a good point. However, because my application is going to be commercial I really don't want to relay on my users have java installed, nor do I want them to have to install it. Plus, I'm not really downgrading because it does not install anything, and it won't affect what the user has installed currently. From your response then, I guess that it is correct that I have to bundle a 64 and 32 bit version! Oh yes, and I need to bundle the JRE because my application connects to my site via SSL and for some reason, it doesn't work properly with the keystore...] – Andy Nov 03 '11 at 20:13
  • @BrianKnoblauch what do you use to include a current 32-bit JRE then? AND Bill, I'm not sure about mac and unfortunately I haven't really got time to test tonight. However, that's the thing. I can't just ship with 32 bit JRE because for some reason it won't work on my 64 bit machine! – Andy Nov 03 '11 at 20:17
  • I wrote my own initial installation launcher in assembly for Windows that takes care of the JRE. Once the JRE is installed, then I launch the standard Java based installer. The *nix & OS X installs don't do anything with the JRE since (at the time I did my last release) it was bundled in and automatically updated on those platforms. Now that Mac OS X no longer bundles the JRE, I'm going to have to rethink my installation process for that platform (assuming we even continue to support it). – Brian Knoblauch Nov 04 '11 at 12:28
  • @BrianKnoblauch: (Sorry for the slow reply) Thank you for your explanation. It looks like I'm going to be jumping into the same boat seeing as though I've had no look regarding my initial question. I'll probably use a combination of NSIS and Java for the windows installation, but I have no idea for Mac. Really, I only need to be able to write the uninstaller in Java - I can manage with Java for the installation... – Andy Nov 10 '11 at 20:25