How to Make Executable JAR file in Eclipse IDE - Java

If you are Java programmer then you know what is the purpose of JAR file, but for those who are unaware, JAR file is deliverables of Java application. Just like C and C++  application produce EXE files, Java produces JAR files. In other words, A JAR (Java Archive) file is a ZIP format file that bundles Java classes into a single unit, it may contain all the resource needed by Java application as well. There are mainly two types of JAR file in Java:  Library JAR (normal JAR) files: JARs which are reusable libraries e.g. Apache commons JAR file, guava.jar itself or even JDBC drivers e.g. ojdbc6_g.jar. There is another type as well, Executable JAR files: JARs which can be executed as a standalone Java applications. The main difference between normal and executable JAR file is that later contains a mainfest file, which specifies a main-class entry. When you run that JAR file, Java starts your application by reading that main-class entry, because you need the main method to execute Java programs.

I had earlier shared steps to create JAR file from command prompt, which if you have not read, go read it. You will learn about basics of JAR command, which comes with JDK, mainfest file and different attributes of manifest file.

In this tutorial we will learn how to make/create/export both library and executable JAR file in Eclipse IDE. Why it's important to know creating executable JAR in Eclipse, because its one of the most used tool by Java programmer.

Once you know the steps, you export your Java program as JAR file in a second or two. After creating executable JAR file, you can follow these steps to run Java program from JAR file in command line.

Steps to Create Executable JAR file in Eclipse

A picture is worth more than a thousand words, that's why I have provided all steps by taking screenshots. You can quickly learn how to create executable JAR for your Java application in Eclipse, by just looking at these screenshot. They are arranged from start to end. Which means first image is for first step and last image is for last step. By the way, if your application is dependent upon some other JAR files e.g. third-party library, then don't need to include them inside JAR. All you need to do is include them inside your Java Classpath. Java is smart enough to pick classes from those JAR. Also remember to include main method or entry point of your Java program, while creating executable JAR, as you can not run a Java program without main method, as discussed here.

Step 1
Select your project and click on the export option.

Step 2
Choose Java and select JAR file for exporting

Step 3
Now select the source and resources you want to export into JAR file. After selecting src folder and any resource, select the destination folder, where you want your JAR file to be created. Also don't forget to check option "compress the content of JAR file". This will reduce size of executable JAR file. If you want you can finish the process in this step, but you can also go one step further to save these instruction of executable JAR file creation for future use.

Step 4
In this step you can save all instruction into a "JAR description" file for future use. This will create a description file e.g. Test.jardesc in the chosen folder.

Step 5
This is an important step, because you are going to generate the manifest file, don't forget to choose main class. This is important to make your JAR an executable JAR file. Remember main method is entry point of any Java application.

Step 6
You are done with creating executable JAR file. Now you can go to the target folder, which you have chose in previous steps to see both JAR file as well .jardesc file to recreate JAR file again and again. This time you don't need to include main class as well, as those are already included.

Step 7
After making code changes, if you want to create a new JAR file, you don't need to go through all previous steps. This time, just select your JAR description file and say "create JAR", a right click menu option in Eclipse. This will create another JAR file in same folder. You can double check timestamp of JAR file.

That's all about How to create or make Executable JAR file in Eclipse IDE. By following these steps you can export your Java program as executable JAR, which allow you to share your program with your user, client and any one who wants to take a look. I strongly suggest to save instruction to export JAR file, so that you don't need to run through all these steps again and again. Next time, when you update your code, just click on your jardesc file and your JAR file will be ready in a blink.

Further Learning
Beginners Eclipse Java IDE Training Course
Eclipse Debugging Techniques And Tricks
The Eclipse Guided Tour - Part 1 and 2


  1. love this blog so much.. thank you javin paul for beng a blessing to me.. I would love to see more on data structures and algorithms in java.. thanks alot

    1. Thank You Anonymous. I will surely write some more tutorials and interview question experience on data structures and algorithms in Java. Stay tuned.

  2. hey admin hi.., m just a beginner in Java, i just want to code a java transliteration programme (from English to Hindi).This is my project task and i really don't know where to start from.Please help me.

  3. Thanks, it worked.

  4. Finally I found, very very thanks

  5. I tried to doing the Same but i am facing a problem , IN Java virtual machine launcher "A Java Exception has occurred" message is displayed.
    Admin can u let me know a way to resolve it

  6. Hello, This is not working with JUnit Test Suites. Please help to add all packages in JAR.

    1. If your project is depending upon other JAR file e.g. JUnit (your real code should not depend upon JUnit ) then you also need to add those JAR while exporting. Manifest file contains entries for them.

  7. I follow but there is error "jar creation failed", show details: "Exported with compile warning...". Can you show me how to fix this problem.

    1. It could be due to compilation error in your project, just make sure you project compile and run fine before you make executable JAR file.

  8. Hi,

    Thank you for your help but... I´m facing an annoying problem here, that I don´t know how to solve.

    Well... I´m new in Java, so.. be pacient.. =D

    I´ve been followed all those steps but when I try to run the .jar file by "double click", the following message is showed at the prompt:

    "Error: Could not find or load main class"

    AND when I try to load via command line, well... that´s the return:

    java.lang.NullPointerException: Location is required.
    at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml.FXMLLoader.load(Unknown Source)
    at application.Main.start(
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163
    (Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(Unknown
    at com.sun.javafx.application.PlatformImpl.lambda$null$174(Unknown Sourc
    at Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(Unknown S
    at$ Source)
    at Method)
    at$null$149(Unknown Source)
    at Source)

    Can you help me please?

    My project loads a simple FXML file.

  9. i created jar file as per your screenshot but how to execute that jar file

  10. Your site helped me a lot.Step by step explanation with appropriate and clear screenshots..Great Job.

  11. Hello, I went through the process and the jar file was created, but it does not work when I click on it.

  12. Hello...please also share the steps to create Library JAR files in Eclipse

    1. Hello Rashmi, just follow the same steps but don't select any Main class.