SCJP Certification

Sun Certified Java Programmer Certification exam essentials

October 13th, 2009

What is a JAR file?

Java Facts, by Daisy Williams.

A JAR file is a bundling and deploying utility that executes upon Java programs. The JAR tool is used to create a JAR file. The file contains class files, image files, and audio/video files. It also contains a manifest file, which contains information such as whether the class file is a javabean, or which class contains the main method, etc. The basic syntax of the command for creating a JAR file is as follows:

jar -cf jar-file input-file(s)

where,

c indicates a JAR file is going to be created.
f indicates the output of the command execution will go to a file rather than to stdout.
jar-file is the name of the resulting JAR file.
input-file(s) specify a space-separated list of one or more files that are going to be included in the JAR file. It can use the wildcard * symbol.

After using this command, it will generate a compressed JAR file and place it in the current directory. It also generates a default manifest file for the JAR archive.

Share

Back Top

Responses to “What is a JAR file?”

Comments (0) Trackbacks (1) Leave a comment Trackback url
  1. No comments yet.
  1. How the classpath is searched for a JAR file syntax? | SCJP Certification (,November 19, 2009)

    [...] 19 While using a JAR file when a directory is specified in the classpath, the files are searched in the directory [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

*