Kenneth Pronovici <[EMAIL PROTECTED]> writes: >> > >For #8: >> > >We should add that all jars should have a manifest (but without >> > >Class-Path). Ant can autogenerate a manifest, or does, I forget? >> > >> > BTW: I never yet touched Manifests, what are they actually for? :) >> >> Manifests are a child of java applets. Sun needed a place to put >> metadata info like classpathes in single-jar applets and thus >> Manifests were born. >> >> They are mostly useless in a non applet context.
? > Are you sure about that? I believe I have also used a manifest when > creating a standalone executable-in-a-jar (to be run with 'java -jar'). > > Ah, yes, I did remember that correctly: > > http://java.sun.com/docs/books/tutorial/jar/basics/manifest.html > > This page says, "[i]f you're interested only in the 'ZIP-like' features > of JAR files such as compression and archiving, you don't have to worry > about the manifest file. The manifest doesn't really play a role in > those situations." > > However, for Java 1.2, the manifest apparently allows you to do things > like seal the JAR, create applications bundled in a JAR file, etc. So, > the manifest is not quite mostly-useless in a non-applet context. :-) Manifest files are used to set the classpath, set the Main-Class to be executed (see argouml exemple below), contains informations about signing the jar... and with the manifest file, you can tag a version to the jar! Here is the manifest file for argouml: Manifest-Version: 2.0 Main-Class: org.argouml.application.Main Class-Path: xerces.jar nsuml.jar ocl-argo.jar gef.jar i18n.jar antlrall.jar log4j.jar jh.jar saxon.jar toolbar.jar toolbutton.jar jaxp.jar crimson.jar parser.jar xml4j.jar jmi.jar Created-By: 1.2 (Sun Microsystems Inc.) Name: org/argouml/application/ Specification-Title: ArgoUML Specification-Version: @version@ Specification-Vendor: University of California Implementation-Vendor: University of California Implementation-Version: @version@ Implementation-Title: ArgoUML (@version@ are replaced at build time, I did copy the template). I run argouml with java -jar /usr/share/java/argouml.jar "$@" One thing I don't know is: Is the manifest classpath recusive? I mean if I need xerces.jar, do I have to put jaxp.jar? Or do xerces.jar specify a classpath in its manifest file with jaxp.jar? Note that some unzip and sed/awk scripts can extract the classpath from a jar file, can't they? Cheers, -- .''`. : :' :rnaud `. `' `-
pgp00000.pgp
Description: PGP signature