Maybe some of you have already wondered what this is.
JAR File
A JAR file is a Java Archive based on the popular ZIP file specification from PKWARE. If a JAR file includes a META-INF directory, the contents will be interpreted by the JVM.META-INF/MAINFEST.MF
The MANIFEST.MF is used to define extensions and package information for the JAR file.Manifest Name Value Pairs
The Manifest file can contain a number of Name Value pairs in the form of name: value. Each of theses pairs is delimited by a newline. Popular names are Main-Class or Class-Path.The Trick
If your application consists of a number of JAR files and you have different entry points, aka Main Classes, you can save a lot of maintenance time by packaging everything as usual and create special JAR files for the entry points.Sample MANIFEST.MF
Here is a MANIFEST.MF snippet taken from OC4J to explain this:Manifest-Version: 1.0This way, you refer to the Main Class packaged somewhere in the Class Path (ie. oc4j.jar in this case). You'll find this snippet in the MANIFEST.MF of admin.jar.
Created-By: 1.3.1 (Sun Microsystems, Inc.)
Main-Class: com.evermind.client.orion.Oc4jAdminConsole
Class-Path: oc4j.jar
It is important to note that the Class Path is relative to the working directory of the JAR file.
Usage
Using such a JAR file is easy (shown for OC4J's admin.jar):java -jar admin.jar
Comments (4)
hi,
Can you tell how we can add multiple entries in class-path from jdeveloper.
Regards,
Imran
Posted by imran raza khan | November 28, 2007 1:27 AM
Posted on November 28, 2007 01:27
Imran, will write an entry on this. --olaf
Posted by Olaf Heimburger | November 28, 2007 1:47 AM
Posted on November 28, 2007 01:47
How to set jar file version and how to get jar vesion in tomcat server console
Posted by Anonymous | July 28, 2008 10:09 AM
Posted on July 28, 2008 10:09
How to get jar version for the user defined jar in tomcat server console
Posted by shan | July 28, 2008 10:10 AM
Posted on July 28, 2008 10:10