Introduction to Java deployment:
We learned more about Java Swing in our previous tutorial, in this tutorial, we will learn how to deploy a java project.
Once coding has been completed, you have to wrap all the files as a JAR file and that jar file can be deployed in any required machine. Check our interesting Java training series.
Here is a Video tutorial on Java Deployment:
To Create a Java JAR file
Right-click the project folder and select “export “option.
Select the java folder and select the jar file inside the java folder.
Enter the File name and file location to save.
Click on finish.
Now, you can get the jar file in the specified location.
To Run the JAR file
You can run the jar file from the command prompt/ terminal.
First, you need to go to the directory in which you have the jar file from the terminal/command prompt.
Then, type the below command and hit enter,
java –cp JarName mainclass_with_packagename
Now, the program has been executed.
Conclusion
Java class files can be wrapped as a jar file and that can be executed in any machine.
In this tutorial, we learned how to build a jar file and execute it.