For that I used an open source program called launch4j (launch4j.sourceforge.net).
Here are the steps needed to create your own executable out of java jar files:
1) Make sure you have your main program jar file, any utility jar and resources files available in the same directory.
2) Make sure that your main program jar file's MANIFEST.MF file contains the following information:
Class-Path: *.jar
where *.jar is the list of jar files your main program needs and that should be in your classpath. For example in my case this was: Class-Path: nsclient4j.jar
Main-Class: PathOfClassContainingMainMethod
where PathOfClassContainingMainMethod is the name of the class that starts your program.
For example in my case this was:
Main-Class: net.sf.rcpperfmon.deamon.HostPerformanceStatsDeamon
3) Start Launch4j and fill these minimally needed information:
- output .exe name.
- main jar file containing the startup class.
- minimum jre version.
Once you press on the build button you should have your .exe correctly create as per the below figure.
Happy coding.....and wrapping.....