This procedure explains how to generate a runnable JAR file for your Eclipse project

1. In Eclipse, go in the “File” menu and choose “Export…

2. Select then “Java -> Runnable JAR file

You arrive then with the following window :

screen_shot

3. You can then decide which class that contains the main will be launched. You can also decide where to put the generated JAR file. 

4. Click then “Finish” and you should have a file containing every required data. This file is directly usable on Windows and Mac and if you click on it, it will launch your program.

Running on Linux

properties

On Linux, if you want to be able to click on the file to launch it, you have to say the file is executable. To make this, right-click on the JAR file, choose “Properties“, go the “Permissions” tab and check the Executable tick. You can now right-click on the JAR file and choose “Open with” and select OpenJDK.