views:

197

answers:

2

I'm trying to bundle a JRE with my jar file so that I can run my application on any windows computer, regardless of if it has Java or not. The jsmooth manual says:

For the option to work correctly, you have to put a JRE in a directory near the EXE (generally in a subdirectory called "jre" or whatever). Once the exe is generated, it will FIRST try to locate the JRE at the location mentioned. If it can't be found there, then it will fallback in the normal jre look-up mode (search for a jre or a jdk in the Windows registry or in commonly-used environment variables). There is no JVM-version check when using a bundled JRE, as the packager is supposed to bundle a suitable JVM for the application.

Does this mean that the jre subfolder should be included in the jar, be its own separate jar, or put in the folder that comes along with the exe? If it is supposed to be in a folder with the exe, how can I specify the relative path to the jre subfolder?

My directories are as follows:

setup/

-jre/

-myprogram.exe

I tried using ..\jre, .\jre, ..\setup\jre in the GUI screen, but none of them worked.

Any ideas or leads would be greatly appreciated. Thanks so much!

EDIT: when I tried jre (and ..\jre I think), I got the following error message from windows when I tried running it "MyProgram.exe has stopped running." When I look at the problem details, it says APPCRASH and the fault module name is jvm.dll

A: 

As an alternative, I would suggest using the mature open source project, NSIS. You could write an installer that would download and install the JRE, and then create shortcuts to run your program.

Here are some useful links:

Sualeh Fatehi
A: 

Have you tried Launch4J (http://launch4j.sourceforge.net/), we switched from JSmooth to this a while ago, as it was more up to date and had more features.

But, put the jre folder in the same folder as the .exe, then use jre\ as the path to it. You'll need to make sure the working folder of the .exe is the installation folder though. And make sure you have a full JRE in the jre folder.

Dan Godfrey