Skip to content

Jar

The Java™ Archive (JAR) file format enables you to bundle multiple files into a single archive file. Typically a JAR file contains the class files and auxiliary resources associated with applets and applications.

Common JAR file operations

To create a JAR file

:

$ jar cf jar-file input-file(s)
To view the contents of a JAR file

:

$ jar tf jar-file
To extract the contents of a JAR file

:

$ jar xf jar-file
To extract specific files from a JAR file

:

$ jar xf jar-file archived-file(s)
To run an application packaged as a JAR file (requires the Main-class manifest header)

:

$ java -jar app.jar

To invoke an applet packaged as a JAR file

<applet code=AppletClassName.class archive="JarFileName.jar" width=width height=height />

See also

Favorite site

Lesson: Packaging Programs in JAR Files