The only way I could bind the JRE was to use Launch4J and the Inno Setup compiler.
First create a “jre6” folder (for example) in the same directory as your output file (.exe).
Then copy the JRE from your system to the jre6 folder.
Then you open Launch4J and install the "JRE Bound Path" - just type: jre6. Then click on the “Create” button (obviously after entering all the other parameters), but the only value you need to enter on the “JRE” tab is the value “Associated JRE value.”)
I would expect this to work, but if you move .exe to a new location (so that it no longer resides with your jre6 folder), you will get "This application has been configured to use the unified Java Runtime Environment but is missing or corrupt at runtime An error occurred while trying to start the application ...
I play with this all day and I could not get Launch4J to include the JRE in the .exe file. In fact, I believe that they are poor, as their documentation does not seem to refer to this problem at all.
So, I decided to allow the use of the Inno Setup compiler. This application is used to transfer your .exe as a Windows Installer file. Therefore, I added an ISC script parameter that copies the JRE to the installer package. The line I added to the script (in the [Files] section):
Source: "M:\Netbeans\MyApp\jre6\*"; DestDir: "{app}\jre6\"; Flags: recursesubdirs createallsubdirs
... a bit of a workaround, but he did the trick.
Repeat all the above steps and you should be sorted.
ANSWERS FROM here ..user1617737
Ridzuan Adris May 15 '14 at 2:49 a.m. 2014-05-15 02:49
source share