JDK-5032358 : "java.util.zip.ZipException: The system cannot find the file specified"
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 1.4.0,1.4.2,1.4.2_03,5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,solaris_9,windows_xp
  • CPU: generic,x86,sparc
  • Submitted: 2004-04-15
  • Updated: 2009-07-17
  • Resolved: 2009-07-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7 b64Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
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.
###@###.### 2004-04-15

EVALUATION The FileNotFoundException is thrown on Windows platform alreays after switched to winFileHandleOpen for long path support.

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: dragon

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. ###@###.### 2004-04-15