PDF download Download Article PDF download Download Article

After having completed your project in Eclipse, your next goal will be to create a runnable version of your project. While Eclipse doesn't have the ability to export a Java project as an ".exe" file, you can export it as a runnable JAR (.jar) file, which works similar to an executable (.exe) file. You can then use a program called Launch4j to convert the JAR file to an executable file. This wikiHow teaches you how to transform a typical ".jar" file to an executable file!

Part 1
Part 1 of 3:

Exporting from Eclipse

PDF download Download Article
  1. Eclipse has an icon that resembles a blue circle with lines through it and a yellow crescent. Click the icon to open Eclipse. This will open your most recent Java project in Eclipse.
    • If Eclipse does not open the Java project you want to export, see if you can find the project folder in the Package Explorer to the left. If you can't, click File in the menu bar and click Open file . Navigate to the ".java" file you want to open and click Open . You can also find recent project under Open recent in the "File" menu.
  2. You project is listed in the panel to the right. Right-click it and click Refresh near the bottom of the menu. This is to ensure all your code is up to date and won't conflict when you try to export it.
    • Alternatively you can right-click and hit F5 on your keyboard.
    Advertisement
  3. It's in the menu that appears when you right-click your project in the Package Explorer panel to the left.
  4. This option allows you to save your project as a runnable JAR file.
  5. The main class is the class that contains the method with the identifier called "main". This is the class that indicates where your program begins. Use the drop-down menu under "Launch configuration" to select the main class of your project.
  6. This is the location you will export the JAR file to. You can either type the destination in the field below "Export destination" or use the following steps to select an Export destination:
    • Click Browse .
    • Navigate to the folder you want to save the JAR file to.
    • Type a name for the JAR file next to "Filename".
    • Click Save .
  7. Do not worry about the rest of the menu.
  8. This exports your Java project as a JAR file.
  9. Advertisement
Part 2
Part 2 of 3:

Creating an Icon

PDF download Download Article
  1. This is the icon you will use to click on your program. You can search for an icon to use online, or you can use a graphics program like Photoshop, GIMP, Paint, or Preview to create your own graphic.
    • The image size must be 256x256 in order to work properly as an icon.
  2. Go to https://convertico.com/ . This is a free site that converts common image files (.png, .jpg) to a usable ICO (.ico) file.
  3. It's in the center of ConvertICO. This will upload your image file and convert it to a ICO file.
    • Alternatively, if you have an image from the internet, you can enter the web address in the bar that says "Select file from URL".
  4. It's in the box to the right. Once your file is uploaded, this box turns pink and an arrow pointing down appears. Click the arrow to download the image as an .ICO file.
    • By default, you can find your downloaded files in your Downloads folder.
  5. Advertisement
Part 3
Part 3 of 3:

Creating the Executable File

PDF download Download Article
  1. This is a free program designed to compile all your resources into one executable file. Use the following steps to download and install Launch4j.
    • Go to http://sourceforge.net/projects/launch4j/files/launch4j-3/3.1.0-beta1/
    • Click Download the latest version .
    • Wait 5 seconds for the download to start.
    • Open the "launch-3.12-win32.exe" in your web browser or Downloads folder.
    • Click Yes
    • Click Next .
    • Click I agree .
    • Click Browse to select an install location (optional).
    • Click Install .
    • Click Finish .
  2. To open Launch4j, click the Windows Start menu and type "Launch4j". Click the Lanuch4j icon. It resembles a computer screen with an IDE program open.
  3. Use the following steps to select a destination and name for the executable file that will be exported.
    • Click the blue folder icon next to the "Output file" bar.
    • Navigate to the location you want to save the file to.
    • Type the name of the file next to "Filename" (make sure it has the ".exe" file extension at the end).
    • Click Save .
  4. Use the following steps to select the JAR file you exported from Eclipse.
    • Click the blue folder next to the bar labeled "Jar".
    • Navigate to the folder with your "JAR" file.
    • Select the JAR file and click Open .
  5. Use the following steps to select the ICO file.
    • Click the blue folder next to the bar that says "Ico".
    • Navigate to the folder with your ICO file.
    • Select the ICO file and click Open .
  6. It's the fifth tab at the top. This tab allows you to select which version of Java you want to use.
  7. This ensures that the users have a sufficient version of Java to use your program. You can enter a different version if needed. Version 1.4.0 is a safe version for most users.
  8. This is the gear button that says "Build Wrapper" when you hover over it.
  9. Most users won't see the XML file. Give it any name you choose. Type the name of the file next to "Filename" and click Save . Your executable file will now be created!
    • You may need to temporarily disable your antivirus software to run the executable.
  10. Advertisement



Community Q&A

Search
Add New Question
  • Question
    What should I do if the executable file doesn't open?
    Community Answer
    Check if you exported JAR properly, defined all the paths, and launched configuration according to your main class. The JAR export might be damaged, in which case your .exe file wouldn't work.
  • Question
    Is it possible to wrap an appropriate version of JRE with the executable so that the end user doesn't need any JRE installed to run the program?
    Community Answer
    Yes. In Launch4j, under the JRE tab, it's the first field at the top.
  • Question
    Where should I get a .ico file?
    Community Answer
    You can create a .ico file yourself with SIB icon editor, or download from the web.
See more answers
Ask a Question
      Advertisement

      Video

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!

      About This Article

      Article Summary X

      1. Open Eclipse.
      2. Press F5 to refresh your project.
      3. Right-click your project and click Export .
      4. Expand "Java" and double-click Runnable JAR file followed by Next .
      5. Select the main class under "Launch configuration".
      6. Click Browse and select a destination and filename.
      7. Ensure "Extract required libraries into generated JAR" is selected and click Finish .
      8. Find or make a 256 x 256 image to use an as icon.
      9. Convert the image to an "ico" file at https://convertico.com/
      10. Download Launch4j at http://sourceforge.net/projects/launch4j/files/launch4j-3/3.1.0-beta1/ .
      11. Open Launch4j and type and destination for the file next to "Output File".
      12. Select the JAR location next to "Jar".
      13. Select the Ico file next to "Ico".
      14. Click the JRE tab and type "1.4.0" next to "Min JRE". 15. Click the gear icon and type a name for the ".xml" file next to "Filename" and click "Save' .

      Did this summary help you?
      Thanks to all authors for creating a page that has been read 609,513 times.

      Reader Success Stories

      • Elizabeth Scots

        Jan 10, 2017

        "Really helpful to newbies who are just getting into programming with Java on an IDE. Covers all the steps well and ..." more
      Share your story

      Is this article up to date?

      Advertisement