aspose file tools*
The moose likes Java in General and the fly likes Need Help To Resolve Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need Help To Resolve Error" Watch "Need Help To Resolve Error" New topic
Author

Need Help To Resolve Error

Rob Levo
Ranch Hand

Joined: Oct 01, 2000
Posts: 167
Exception in thread "main" java.util.zip.ZipException: The system cannot find th
e file specified
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
Above is the error I am getting when I run an app using java -cp ....... -jar app.jar
I do not understand because the ZipFile appears to be in rt.jar which is included in my classpath.
Would appreciate help in resolving this error.
Thanks ranchers,
Rob
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Originally posted by Rob Levo:
I do not understand because the ZipFile appears to be in rt.jar which is included in my classpath.
That sounds right. The error message doesn't say that it couldn't find the ZipFile class, it just says that the specified exception was thrown from an instance of that class. The documentation for ZipException tells us a bit about what it means when such an exception is thrown: "Signals that a Zip exception of some sort has occurred." Not excessively informative, but it's something.
It would seem that the file you were trying to open couldn't be found.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I am able to replicate your experience with this code:
Adi Nayak
Greenhorn

Joined: May 16, 2002
Posts: 3
The same code was tried out and it's working fine.
I think there must be some problem in your class path setting. Because of which .zip file is not found.
try{
File f2=new File("D:\\emiti\\p3\\DW.zip");
ZipFile f1=new ZipFile(f2);
System.out.println(f1.getName());
}catch (Exception err)
{
err.printStackTrace();
}
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Adi,
I don't understand your assertion. How is this related to the classpath setting? It would seem (by my example and your example) that the specified zip file is not being found because it does not exist at the specified location. The zip file does not need to be in the classpath in order to be found - its location just needs to be specified correctly.
Rob are you having any luck with this one?
Rob Levo
Ranch Hand

Joined: Oct 01, 2000
Posts: 167
Got derailed, I will have to get back to it. But it sounds like I have a file which is not being found correctly.
I am not using the ZipFile class directly. The first time I heard of it is when I got the error.
This is my guess, given all the above help:
My classpath is incorrect which is not allowing one of the .jar files to be found, and the ZipFile class is trying to access that .jar which is not available.
Does that make sense?
Thanks for all the help on this one.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Seems possible.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Help To Resolve Error