samskivert: Random bitching

07 July 2004

What kind of error message is this?

[11:20pm] baltic:~ > java -jar foo.jar
Exception in thread "main" java.util.zip.ZipException: No such file or directory
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.(ZipFile.java:112)
        at java.util.jar.JarFile.(JarFile.java:127)
        at java.util.jar.JarFile.(JarFile.java:65)

It doesn’t even tell me what file or directory is missing. You might think it’s obvious because I just ran the command, but frequently java is run from a shell script and all I see is this baffling crap about zip files.

I was about to suggest that it be more like the error message one gets when specifying a class that doesn’t exist:

[11:24pm] baltic:~ > java nonexistent.Class
Exception in thread "main" java.lang.NoClassDefFoundError: nonexistent/Class

However, that largely sucks as well. At least its not six calls deep into classloader code, which would be on par with the zip business, and it does tell me which class it couldn’t find, but it’s still a sorry excuse for an error message. Is it that difficult to catch the most common exceptions and report something sensible?

©1999–2022 Michael Bayne