How to use jar tool?

"jar": It is a  command line tool for managing JAR files. This tool is distributed as part of the Oracle ( Formerly SUN ) JDK package

You can package your classes in a jar file and that Jar file can be used in class path, also you can use jar commands to view the files of jar and extract the jar itself.

Lets see how we can use the jar command :

1. To create new jar file :

jar cf [jar-file] [input- files]

2. Extract the jar file :

jar xf jar-file

3. Run the jar file :

java -jar application.jar

Note: Assuming manifest file present in jar.

4. Extract the jar file :

jar tf jar-file
Share on Google Plus

About Pranav

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment