Categories
Uncategorized

Java (Lack Of) Documentation

Today, I have wasted an astonishingly large amount of time trying to get this to work:

% java -classpath mylib.jar -jar myapp.jar

Suffice to say, it doesn’t work. It’s not going to. Looking inside the java.c:

    /* Override class path if -jar flag was specified */
    if (jarfile != 0) {
        SetClassPath(jarfile);
    }

It would be really nice if somebody, somewhere had documented that -jar and -classpath are exclusive. I’d be a lot less upset then.

Of course, this would be less of an issue if Java had any tools for helping you to debug classpath issues. Something like Perl’s message Can't locate Foo.pm in @INC (@INC contains: ...) would be astonishingly useful. But apparently there’s nothing like this that I can find.

One interesting thing I did pick up from looking in the source: You can set an environment variable _JAVA_LAUNCHER_DEBUG which spits out a lot of debug info when the JVM starts up.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s