Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 5032358
Votes 4
Synopsis "java.util.zip.ZipException: The system cannot find the file specified"
Category java:classes_util_jarzip
Reported Against 1.4.2 , 1.4.2_03
Release Fixed 7(b64)
State 10-Fix Delivered, request for enhancement
Priority: 4-Low
Related Bugs 6290451 , 6359688 , 4731870 , 4897356 , 5105554
Submit Date 15-APR-2004
Description
When one invokes java with a wrong file name like this:

  $ java -jar nosuchfile.jar

You get:

java.util.zip.ZipException: The system cannot find the file specified
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:112)
        at java.util.jar.JarFile.<init>(JarFile.java:127)
        at java.util.jar.JarFile.<init>(JarFile.java:65)

This also happens with programatic invocation of new JarFile(...);
But as you see it doesn't actually print the file name, which makes the debugging unnecessarily hard.
  xxxxx@xxxxx   2004-04-15
Work Around
N/A
Evaluation
Yes, it would be very good to emit a better error message.
Not just here, but in other places within jar/zip.

The jar command should explicitly catch FileNotFoundException,
(among others) and issue a nice informative localized message.

  xxxxx@xxxxx   2004-04-15
The FileNotFoundException is thrown on Windows platform alreays after switched to winFileHandleOpen for long path support.
Posted Date : 2009-06-03 06:07:25.0
Comments
  
  Include a link with my name & email   

Submitted On 13-OCT-2005
dmartinfamecom
Except, so long as bug 6290451 is present, it does no good to catch FileNotFoundException inside the jar tool, since that exception isn't thrown by the underlying ZipFile class when a file is not found.



PLEASE NOTE: JDK6 is formerly known as Project Mustang