How to Create an Executable Jar File in Eclipse


Executable jar files are a certain type of Java Archive files which can be executed on user request.
These files show the desired output just like any other executable file.
In this tutorial, we will teach how to create an executable jar file using eclipse IDE.

Step 1 – Use the export option

In order to create jar file in eclipse, we will use the small program of hello world. It will simply display the text “Hello World” on the screen. Now let us convert this piece of code into an executable jar file.

Right click on the project available under the project explorer and choose the “Export” option from the drop down menu.

Export a project

Step 2 – Choose the File Type

As a result, an export window will open up. As we have to create executable jar file, we will choose the Runnable jar file option inside the Java folder and then hit the next button.

Runnable jar

Step 3 – Name the file

Now another window will open up in which we have to specify the filename and the export destination path.
We will name our file “runable_jar” and change the location to documents. Once done with the changes, click on the finish button.

Set the export destination

Step 4 – View the executable file

In order to view the executable jar file we just created, open up the location which was specified in the export window.

In this manner, you can create jar file in eclipse.

Go to the directory where the executable file was exported