Wednesday, March 9, 2016

How to create shippable desktop applications in java using Eclipse IDE

Problem Statement:
I want to create a jar which I can run standalone using Eclipse IDE

When the code is ready and all the code is written up and the application is ready to be shipped as standalone application, following are the steps needed:

(a) First recheck whether there is no compilation error.

(b) Confirm all the dependency project and jar is in the build path

(c) Right click on java file which contains main method and click Run As -> Java Application, this will set the launch configuration (see next step)

(d) Now Right click on the project and click "Export...". It will open a Export Dialog Box

(e) On the Export Dialog, select Runnable JAR file inside java tree selection and click Next

(f) Choose from Launch configuration (it will give you the entry point i.e. java file with main method, see step (c) for that)

(g) Choose Export Destination (i.e. jar name and its path where it will be created). Make sure you provide valid path. Use "Browse.." button to choose or select.

(h) select Package required libraries into generated JAR option

(i) click Finish button.

Your jar is ready to be shipped as standalone desktop application.