JDK-4502009 : java -jar crashes !!!
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2001-09-12
  • Updated: 2004-01-14
  • Resolved: 2004-01-14
Related Reports
Relates :  
Description
goldeneye:/net/sqindia/export/disk03/tools/surendra/jar-test 464 % java -version
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b78)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b78, mixed mode)
goldeneye:/net/sqindia/export/disk03/tools/surendra/jar-test 465 % ls        
./                META-INF/         NewJar.jar*       Test2.jar         manifest
../               Main.class        Test.jar          Test2.java
HelloWorld.java   Main.java         Test1.java        junk/
goldeneye:/net/sqindia/export/disk03/tools/surendra/jar-test 466 % 
goldeneye:/net/sqindia/export/disk03/tools/surendra/jar-test 466 % 
goldeneye:/net/sqindia/export/disk03/tools/surendra/jar-test 466 % 
goldeneye:/net/sqindia/export/disk03/tools/surendra/jar-test 466 % java -jar NonExistingJarFile.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.<init>(ZipFile.java:115)
        at java.util.jar.JarFile.<init>(JarFile.java:120)
        at java.util.jar.JarFile.<init>(JarFile.java:58)
goldeneye:/net/sqindia/export/disk03/tools/surendra/jar-test 467 % 

Comments
EVALUATION I agree that a better error message could be given. From the stack trace of the unhandled exception, however, it is very obvious what has gone wrong. Hotspot gets an unhandled exception, but does not crash (segv or core). From this, I believe this bug should be fixed for the release after merlin. ###@###.### 2001-09-14 This is also broken in ladybird 1.3.1-b24. We may want to send fix when we have one to CTE for back porting. This use to work in 1.2.2_10, message from that release is Failed to load Main-Class manifest attribute from foo.jar ###@###.### 2001-12-11 I don't think this is a hotspot bug anymore. The launcher or library are throwing these exceptions. I think they came from java.util. ###@###.### 2002-11-06 This appears to be a launcher issue. Error messages should be clear and consistent. The printing of the Java stack trace is bad, because it _appears_ that the `java' command has crashed, when in fact it is working as designed. Certainly the stack trace leaves no doubt as to what the problem is (to an experienced programmer). However, users deserve better error messages. Here's what should happen: java -jar nosuchfile.jar ==> Cannot open jar file nosuchfile.jar: No such file or directory (suitably L10Nized, of course) We do not want to revert to the older behavior, namely of printing "Failed to load Main-Class manifest attribute from..." because that would be misleading. However, if we fix this, we should also do a better job of handling other common exceptions in java.c like this: java NosuchClass ==> Exception in thread "main" java.lang.NoClassDefFoundError: NosuchClass ###@###.### 2003-04-01 Generally a reasonable request; although messages from the launcher are not localized. However, the launcher uses Java code in the partially running vm to open and process the Jar file. The jar/zip code does not give a failure indication other than throwing an exception. Therefore, detection of this condition would require redundant code in the launcher, at least to try opening the file using the same security policy, etc., as the vm. Will investigate how large a change would be necessary to address this problem. ###@###.### 2003-04-02 Will re-examine in context of changes made for 4811102. ###@###.### 2003-10-21 Friendly error message generated after changes from 4811102; closing as not reproducible. ###@###.### 2004-01-13
21-10-2003