Java Deployment: Creation and Execution of Java JAR File

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.

Java Deployment

Here is a Video tutorial on Java Deployment:

To Create a Java JAR file

Right-click the project folder and select “export “option.

Java JAR File - Export

Select the java folder and select the jar file inside the java folder.

select jar file

Enter the File name and file location to save.

Save the Jar file

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

Execute Java Deployment

Now, the program has been executed.


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.

PREV Tutorial | NEXT Tutorial