Create Exe from a Java Project with Many Jars Included
With 3 steps you can easily create an exe file from your project that may have many included jar libraries (mine had 14 jars). I used Netbeans 8.0.2, lauch4j 3.16, and Linux Netrunner 14 for this process.
1) Create your xml file with launch4j: It is required on the build level and will be done only one time. Simple details will be enough like min jre level and name etc.Here what I use as xml file for launch4j.It just takes icon file and min jre.
Create a folder and name it misc under your project folder (Mine is /home/mstf/NetbeansProjects/MyProject/misc).Your one jar file will be exported to exe folder ( which you don’t have to create since it will be created automatically) and put this temporary xml to misc folder with the name l4j-myapp.xml
2) Add a new build target to your build.xml to run Launch4j automatically.It can found under your project on the Files tab.
Open build.xml and add these target code before the </project> closing. You need to update your lauch4j folder by using location after the <property name=”launch4jexe.dir” tag. Also you can give any name to your one jar output file but it is not important.Save the build.xml file and close it.
3) The last step is creating your exe. Now again using the same Files tab click right on the build.xml and click on Run Target -> Other Targets -> package-for-lauch4j
Compile output will be like this and if there is no error you can get your exe under exe folder.