Although wrapping a jar in an Exe file doesn’t make any sense as it can be extracted easily using tools like WinRAR, you can still avail the benefits of it if you want to deploy your application on a client side machine. Here are the steps in which you can convert jar to .exe using Launch4J for a project.
Before proceeding further, download this software from this link and install it on your computer/ laptop. Once this app is installed on your PC, follow these below steps.
Note: Before you go ahead, make sure that you’ve completed your project, and the-the application runs fine without displaying any errors.
Convert jar to exe using Launch4J (Tutorial)
- Click on new Configuration menu.
- When a popup window appears saying discard changes, click on yes
- Now Select the path to your output file (suppose you want to create an executable named project.exe in D:\ directory then your path to output file would be D:\project.exe )
- Select your project Jar File.
- Leave manifest Textfield as it is.
- Select your icon file for your executable. Exe file
- Leave other tabs on the basic tab as it is.
- Leave all fields in Classpath tab as it is.
- Leave all fields in Header tab as it is.
- From the single instance tab, select allow single instance checkbox and enter the process name for your application in the remaining two fields on single instance tab.
- In jRE tab, Min JRE Version (Java Runtime version) for your application and leave all other fields as it is.
- Leave all fields in the set env variables tab as it is.
- Leave all fields in splash tab as it is.
- Enter your project version in version info tab.
- And finally, in Messages tab uncheck add custom messages.
- Now click on the build wrapper menu so that your .Exe file will get created in the location you had specified in step 3.
- Hence, your .exe file gets created
- Done !!
If you don’t want to handle the pain of performing the above tasks, please use the plugins (Launch4J plugins) that are developed to automate this task on NetBeans or the Eclipse platform. Apart from this software, there are many other tools that will help you to convert Jar to Exe file. Google search results will show you many such tools and most of them are free to use. I Hope you’ve found this little tutorial useful.