When you compile application at that time java compiler converts your java file to jar file. But this jar file will not run on a machine which doesn’t have a java compiler(JRE) installed. That’s why it’s important to convert jar to exe file and exe file can run on any windows machine.
If you want to convert jar file to exe file and run exe file without JRE then you can do it by following methods:
1. Using netbeans
The following additional tool need to be installed:
- Inno Setup 5.5 (or more recent) for producing EXE installers on Windows is required.
you can download Inno Setup from http://www.jrsoftware.org
To add Inno Setup to the system Path variable:
1. On Windows 10, select Start> Control Panel > System and Security > System >Advanced system settings
2. Select the Advanced tab and click the Environment Variables button.
3. In the System Variables pane, double-click the Path variable.
4. In the Edit System Variable dialog box, add a new path to the Variable value field (for example, C:\Program Files (x86)\Inno Setup 5).
5. Click OK to close all the open dialog boxes.
Enabling Native Packaging in the Netbeans IDE
The native packaging actions are disabled in the IDE by default.
1. Right-click the project node in the Projects window and select Properties from the context menu.
2. In the Project Properties dialog box, choose the Deployment category and select the Enable Native Packaging Actions in Project Menu option.
3. Click OK.
A Package as command is added to the project’s context menu.
4. Now click on clean and buid project button( or press shift+F11)
5. Right-click the project node in the Projects window and select Package as > EXE installer from the context menu.
After this, you can see your exe file from Files tab select your project > dist > bundles.
2. Using Excelsior JET
you have to install Excelsior JET on your pc.you can download it from https://www.softpedia.com/get/Programming/Coding-languages-Compilers/Excelsior-JET-for-Windows.shtml/
I hope you like our this Blog related to jar. Please check out our other posts: