Here is how to create an executable jar with eclipse.
1) Create a Java project and create a main class.
2) Select the project and click on Run->Run Configurations... menu. From the left
panel of the Run Configurations dialog, double click on Java Application.
Specify the main class for the configuration, click Apply followed by Close.
panel of the Run Configurations dialog, double click on Java Application.
Specify the main class for the configuration, click Apply followed by Close.
3) Select File->Export... menu. In the Export dialog, select Java->Runnable Jar File. Click Next.
4) From Launch Configuration drop-down, select the Launch Configuration
created in step 2.In Export Destination box, specify the file name for the
exported jar file.
created in step 2.In Export Destination box, specify the file name for the
exported jar file.
5) To test the exported jar file run the following command from the folder where the
jar file is saved:
java -jar filename.jar
jar file is saved:
java -jar filename.jar
Replace filename.jar with the same file name specified in step 4.




