Step-1: Open your IDE (I am using here the Eclipse as an example.)
Step-2: Click on the File (Left top corner)
Step-3: Then click on the new, then java project
Step-4: Then you will find a java project is created like this
Create a class inside the src folder, like this project structure.
Step-5: Then right click on the created project, click on the export option.
Step-6: After clicking on the export option, a new prompt will be open up. In the field ‘type filter text’ box type “Runnable JAR file” like this. And click on the next button.
Step-7: By click on the next button you will be promoted with the new window fill the following item like
Lunch configuration, Export destination (you must specify your path in your way.)
Please follow as per image provided, then click on the finish button.
Step-8: Now go to your destination and check for the Jar file, like this image
Step-9: Now run this jar file by typing the following command in the command prompt, see image.
Step-10: If you want to run it through simple click, you must prepare a batch file. That can be done by following process.
i.Open note pad and type the same command which one you have typed in the command prompt like this image
- Now save this note pad by giving a valid name like Test.bat (Remember the file extension must be .bat).
- Now double click on the newly created batch file and see whatever you want to run, its running successfully.
<iframe frameborder=”0″ height=”200px” id=”frmDev” scrolling=”no” src=”/services/Ads/AppDevelopment.html” width=”100%”></iframe>
Benefit of using:
By creating the batch file and running it from the click mode, you can save the time and manual intervention for the coder. Instead of running it from the command prompt. Further this batch file can be integrated with any continuous integration tool example Jenkins.