Publishing applications in Java

Do you know one of the tasks that we need to do when building a complete application (software)? It is publishing this application into an .exe file for end-users that can be easily used without considering how it is written.
This article is for those who are programming applications in the Java programming language so that you can publish your product.
To do this you should note that the application is built with NetBeans 8.0.x or built on Eclipse and then imported into NetBeans. The software supports publishing products to the .exe file as Launch4j , which you can easily find on the network and then download and install. This is a free software, easy to install with just a few clicks.
So we have finished the preparation, now we can start.
This publication consists of two stages, the first stage is the .jar file creation, the second stage is to create the .exe file for the application.
1. Create the .jar file for the application:
– File .jar is a compiled file after the application is completed. This file is created directly from NetBeans. Users do not need to open NetBeans to run the application, but can run directly from the .jar file by double clicking on it (Note: on the user's machine, there must be a JVM – Java Vitual Machine installed).
– Steps to perform:
Step 1: Select the project you want to publish> right click select Properties > select Run> in Main Class> Click Browse …> select Main Class to publish> click Select Main Class> click OK
published applications in java
Select the project again> right-click and choose Clean and Build
Go to the project store> select the dist folder to check the published .jar file (Note: README.TXT file is also automatically generated, you can write your own instructions / notes about use application in this file)
Double click on the newly created jar file to run the application and check
published applications in java
After checking that the application is running smoothly, we go through the second stage of creating the .exe file.
2. Create an .exe file for the application:
The .exe file is a file created from the .jar file created above. This file is made up of software that supports exporting .exe files (here we use Launch4j ). The .exe file is the file used by the end user by double clicking on it. (Note: on the user's machine, there must be a pre-installed JVM – Java Vitual Machine).
– Steps to perform:
Launch Launch4j
  • Enter the name of the .exe file you want to publish and select the storage location (Note: you can leave it in the root directory of the app for easy access or in the application's dist folder)
  • Find and select the corresponding .jar file (created at the first stage)
  • Select the application icon (the image file is in .ico format)
published applications in java
In Tab JRE:
  • Enter Min version JRE
  • Select the Build wrapper icon> the window that appears> enter the .xml file name> click Save> see the result
  • Select the Save icon> the window that appears> select Save
published applications in java
  • Select the Test wrapper icon, we will see the application will automatically run and display.
To the application's dist folder, they will see the .exe file and the necessary files that have been created. Just double click the .exe file and the application will run.
published applications in java
Update internal content for README.TXT file to guide users to use the application (if necessary).
So our work is complete. It's that simple, aren't you?
ITZone via t3h
Share the news now