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) {

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 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.