How to create executable jar file using eclipse

In most of the projects and applications we will use jar files. It can be 3rd party or even internal organization jar files. JAR files are nothing but Java ARchive which will be wrapped with the bundle of .class files, Java files, images, audio or video are any file formats. Its nothing but same as ZIP file which we used in our daily practice. By using any unzipping tools we can unwrap JAR files to get files inside. Since mainly its used for .class files and by using obfuscate developers can protect their code and implementation from other users. JAR files will be of 2 formats. 1. Non executable JAR file2. Executable JAR fileIn this tutorial we will how to create executable jar using Eclipse and how to run in Windows. Important for creating executable jar file we need to have at-least single main() method in our project which will be executable. STEP - 1: Create new project which we need to implement our functionality In this demo just we will add 2 numbers as like below. We have created Java Project called AddNumbers and we have class called Add2Numbers and we have implemented our code. Run and test the program once we have implemented.

STEP - 3: Click Next and select Project and Class name under Launch configuration: <Add2Numbers - AddNumbers> Also enter the folder path and name to save the JAR file in Export destination: D:\\test\AddNubers.jar and click Finish.