[Java] Export files and exe jar

After building software with java, we need to export or exe file run jar format that can run directly like any other software that is not in eclipse or NetBean to shaking it. This article will guide you to do the job so.

Initially I had 1 project Dijkstra like this and we will do iện create jar file from eclipse and NetBean, then transferred from the jar to exe file if desired (Since the jar file is just like exe executable file and then).

run java in linux

Create a jar file in eclipse

The steps are as follows:
On the eclipse choose File -> Export -> Runnable JAR file

chon runnable jar file

Next select the project or program to produce at Launch Configuration and * .jar file name in Export Distination

xuat file jar

As shown on the Desktop itself to it in.
If you use time windows can be opened like any other program. If you use linux then open terminal (or cmd in windows) to move to the Desktop with the command cd:

cd Desktop

Run the following command file:

java -jar dijkstra.jar

Create a jar file on NetBean

On NetBean you right click project implementation to produce the jar file, selected clean and build. That's it, Now you will see in the project folder dist, in which the project will have a jar file.

export jar file in betbean

Moving from jar to exe file with launch4j

First of all you download launch4j about (search on google for the latest version) or use the version you are currently using here. Install the software as normal and open up.
At the interface of launch4j we implement parameters:

Tại tab basic, we fill in information about the jar file path and exe file after export

basic launch4j

At jre tab you enter information about the smallest version to run the program (dạng x.x.x) jre path and attach if there.

jre launch4j

Finally wheel icon above to export exe file.