How can I distribute my application jar with JRE? I make my executable jar in exe by using launch4j
.
My application is a desktop based swing application. I want to make it like an application that if the user has no JRE installed, they can use it by using the embedded JRE. I give JRE with the application and use it. Uninstallation of the application and JRE will uninstall like games.
I understand that if I give the pre-installed JRE with my application, it will happen. I also see the tab JRE in launch4j
, but I do not understand which path I will give. This link I also see, but there is no procedure or helpful link is given where the total procedure is defined clearly.
Please give some definite answer. I will prefer if your answer is based on launch4j
.
How do you distribute your application? Do you have an installer?
If you do have a installer, you could bundle any jre with it and configure launch4j to use it.
What I did to recreate your use case:
I used a JDK, but I'm sure you can do the same with a JRE. Also, I am pretty sure that you must (or can) use relative paths for your bundle (like I did).
This is my configuration file:
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>C:\temp\demoapp.jar</jar>
<outfile>C:\temp\thing.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir></chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<customProcName>false</customProcName>
<stayAlive>false</stayAlive>
<manifest></manifest>
<icon></icon>
<jre>
<path>myownjdk1.6.0_23</path>
<minVersion></minVersion>
<maxVersion></maxVersion>
<jdkPreference>jdkOnly</jdkPreference>
</jre>
</launch4jConfig>