Creating and Handling JAR files
By: Reema sen
A utility is used to generate a JAR file. Its syntax is shown here:
jar options files
Creating a JAR File
The following command creates a JAR file named Xyz.jar that contains all of the .class
and .gif files in the current directory:jar cf Xyz.jar *.class *.gif
If a manifest file such as
Yxz.mf is available, it can be used with the following command:jar cfm Xyz.jar Yxz.mf *.class *.gif
Tabulating the Contents of a JAR File
The following command lists the contents of
Xyz.jar:jar tf Xyz.jar
Extracting Files from a JAR File
The following command extracts the contents of
Xyz.jar and places those files in the current directory:jar xf Xyz.jar
Updating an Existing JAR File
The following command adds the file
file1.class to Xyz.jar:jar -uf Xyz.jar file1.class
Recursing Directories
The following command adds all files below
directoryX to Xyz.jar:jar -uf Xyz.jar -C directoryX *
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Subscribe to Tutorials
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java
Archived Comments
1. Phylliscicky
View Tutorial By: Phylliscicky at 2017-01-26 14:21:20
2. Phylliscicky
View Tutorial By: Phylliscicky at 2017-03-09 04:27:36