This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
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
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.
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
posted
0
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
posted
0
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
posted
0
Seems possible.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.