For this purpose the following process we have to follow
1 : First time to create one executable jar file .
2: Java code to run this executable JAR file
let me explain
first we have to create one Java application with the help of the eclipse.
- create a package
- create a class , in this class. the main method we have to create one simple statement. with the help of this statement we have to print hello world
run this application.
Now create an executable JAR file.
Save this JAR file in any location
check this JAR file by double clicking if everything is working no problem.
To run this executable JAR file first we have to create one batch file batch file consisting of the following
cd F:\TheProgrammersBook\July_20_2019\RunnableJar java -jar FirstRunnableJar.jar
The following is the Application structure.
The following is the Code to Run Jar file structure.
Jar file and bat file saving location.
Go to thee RunJarFile.java file and run this file .. then the Runnable jar file :FirstRunnableJar.jar file will be run and the output will be as follows.