Showing posts with label how to create jar file. Show all posts
Showing posts with label how to create jar file. Show all posts

Tuesday, 10 September 2019

How to Create a JAR File and Run it


Creating a JAR File

The basic format of the command for creating a JAR file is:

jar cf new-jar-file files-to-be-converted-to-jar

The options and arguments used in this command are:

The c -  to create JAR file.
The f - output to go to a file rather than to stdout.
new-jar-file - name of the resulting JAR file. By convention, JAR filenames are given a .jar extension, though this is not required.
files-to-be-converted-to-jar argument - list of files to be converted to jar .Use space to seperate each file.
If any of the input-files are directories, the contents of those directories are added to the JAR archive recursively.


Above command will generate a jar in current directory.
This command will also generate a default manifest file for the JAR archive.


You will need to use the java command to run a .jar file:

java -jar MyApplication.jar

If you don't have java installed, you can fix that by installing the default-jre package from oracle website.
You can see if you already have java installed by running in a terminal or in command line:

java --version

Unity Top Download

Latest post

An Introduction to Hybris from basics

An Introduction to Hybris from basics:  -- ecommerce site and PCM(Product content Management) solutions. eg. croma website.  -- having sear...

Popular posts