How to Create an Executable File in Eclipse: 14 Steps

Table of contents:

How to Create an Executable File in Eclipse: 14 Steps
How to Create an Executable File in Eclipse: 14 Steps
Anonim

After completing a project in Eclipse (in a Windows environment), you will need to turn it into an executable. The easiest and fastest way to launch a Java project is to create an executable file (.exe). This tutorial will show you how to convert a regular.jar file into an executable.

Steps

Part 1 of 3: Export from Eclipse

Create an Executable File from Eclipse Step 1
Create an Executable File from Eclipse Step 1

Step 1. Right-click on the project, then click "Update" (or F5, if you use keyboard shortcuts)

This step is used to update the project, in order to avoid conflicts during the export phase.

Create an Executable File from Eclipse Step 2
Create an Executable File from Eclipse Step 2

Step 2. Right click on the project again and select "Export" from the menu that appeared

Create an Executable File from Eclipse Step 3
Create an Executable File from Eclipse Step 3

Step 3. Expand the "Java" folder and click on the "Executable JAR File" item

Create an Executable File from Eclipse Step 4
Create an Executable File from Eclipse Step 4

Step 4. Configure the JAR file settings

The first thing to do is to select the main class (the class with the Main method), using the drop-down menu under "Launch configuration".

  • Next, select the destination path, using the "Choose …" button or typing the file path.
  • Finally, verify that you have selected the "Extract the required libraries in the generated JAR file" item. Disregard the other menu items and click "Finish" when you think you have completed.

Part 2 of 3: Create the Program Icon

Create an Executable File from Eclipse Step 5
Create an Executable File from Eclipse Step 5

Step 1. Search or create the image that you will use as the program icon

Keep in mind that the icon is an important part of the program's graphics. It is used every time the executable is started and is probably always present on the desktop! So try to choose it carefully, so that it is indicative of its content. The size of the icon needs to be 256x256 pixels to work properly.

Create an Executable File from Eclipse Step 6
Create an Executable File from Eclipse Step 6

Step 2. Open your browser and go to the convert site

com.

This free site converts your images (.png,.jpg) into icon files (.ico).

Create an Executable File from Eclipse Step 7
Create an Executable File from Eclipse Step 7

Step 3. You can select the image by indicating its URL or by indicating the file path

Click on "Go" to confirm and start the conversion.

Part 3 of 3: Creating the Executable File

Create an Executable File from Eclipse Step 8
Create an Executable File from Eclipse Step 8

Step 1. Download launch4j

This program is free and is designed for putting resources into an executable file. To download it you can go to this address.

Create an Executable File from Eclipse Step 9
Create an Executable File from Eclipse Step 9

Step 2. In the first text field, type or select the folder where you want to place the executable file

Obviously, the file must have an ".exe" extension.

Create an Executable File from Eclipse Step 10
Create an Executable File from Eclipse Step 10

Step 3. In the second text field, instead, type or select the.jar file you exported from Eclipse

Create an Executable File from Eclipse Step 11
Create an Executable File from Eclipse Step 11

Step 4. In the fourth text field, the icon field, type or select the.ico file you converted

If you choose not to indicate the icon, your operating system will use the default one for executables.

Create an Executable File from Eclipse Step 12
Create an Executable File from Eclipse Step 12

Step 5. In the JRE tab of the top panel, under "Min JRE version", type in “1.5.0”

This way, users will most likely have a version of Java that is compatible with your program and will have no problem using it. You can choose the release you want but 1.5.0 is definitely an optimal version.

Create an Executable File from Eclipse Step 13
Create an Executable File from Eclipse Step 13

Step 6. Click on the settings button, marked with a cogwheel, located at the top

Create an Executable File from Eclipse Step 14
Create an Executable File from Eclipse Step 14

Step 7. Name the.xml file with an appropriate name and save

The xml file is a standard type, so you won't have any problems. Finally, your executable file will be created!

Advice

  • The image size must be 256x256 and remember to select the.ico file in launch4j.
  • Check that all file extensions are correct (.exe,.jar,.ico,.xml).

Recommended: