Preskočiť na hlavný obsah

How to use Java Jar Tool?

If you need to package your classes in a jar file use jar command line utility. Creted Jar file can be used in class path.

creates new JAR:
jar cf target.jar inputfiles: It is used to

to view all the files of the JAR:
jar tf somefile.jar

to run a JAR if the manifest file is present in the JAR. The manifest file must contain the information of the class file having main method:
java -jar app.jar

to extract the JAR:
jar xf somefile.jar