Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Thursday, 15 March 2007

The JAR's in Charge

Just a short reminder.

If you load a class from a jar file, then the classpath is whatever the jar file manifest says it is, not what your JVM thinks it is.

So use the Class-Path directive in the Manifest file, and remember that the items appearing in that directive are relative to the location of the JAR file itself.

JAR Manifest Grief Continues

More fragility on the manifest file front.

If you use the Class-Path directive, then note that the if you reference a path rather than other jar files, then that path (at least on *nix systems) must end with a slash character.

JAR Manifest File Agony

Everyone will tell you to finish off the last line of a JAR manifest file with a newline.

What they don't tell you is that if you use the Main-Class directive, then do not have any whitespace at the end of that line.

The JAR File reader includes this whitespace as part of the name of the main class.

You know you have this problem when you seen the NoClassDefFoundError/Exception whatever.