jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes .jar file error opening zip file: Can anyone pinpoint my problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ".jar file error opening zip file: Can anyone pinpoint my problem?" Watch ".jar file error opening zip file: Can anyone pinpoint my problem?" New topic

.jar file error opening zip file: Can anyone pinpoint my problem?

Ryan Dowdy

Joined: Aug 03, 2011
Posts: 8

I am working on a project on a UNIX server. I have been running into compilation issues ever since I started and I've finally reached one I can't figure out how to fix (or maybe I'm too tired). Nonetheless, here is my issue:

When trying to compile my code, I get hung up on a .jar file which the compiler seems to have trouble unzipping. Below are the commands I am putting into the bash shell along with the output that I am receiving:

Upon looking at these lines, we notice two errors, one error from the .jar file and one error in make. Presumably, the error in make is a result of the error in unzipping the .jar file, so we can ignore this for now. The first error that we see arise is the error in opening mapss.jar.

My first thought upon seeing this error was that perhaps the .jar file was corrupted, so I deleted it and replaced it with a fresh copy from the repository where I received it. I soon learned that this was not the source of the problem as I received the same error messages from above.

Perhaps the location of the .jar file is not entered into the makeme correctly? Upon closer inspection, this is not the case either.

Okay, well let's see if I can unzip the .jar file manually on my local machine.

It works perfectly fine and unzips just as expected!

Well maybe there is a problem on the server end? I will try to unzip the mapss.jar file on the remote server in which I'm working on. This also works just as expected!

So why is the compiler having trouble unzipping this file? Any thoughts?
Anayonkar Shivalkar

Joined: Dec 08, 2010
Posts: 1541

Hi Ryan Dowdy,

Welcome to CodeRanch!

Is it absolutely necessary to use relative paths in CLASSPATH variable? I suspect that this might be the issue (that somehow, at some time, cd command is getting fired and then jar file does not exist at relative location anymore).

Please try to use absolute paths in CLASSPATH and then we'll see what happens.

I hope this helps.

Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Ryan Dowdy

Joined: Aug 03, 2011
Posts: 8
Thank you for your reply and warm welcome!

As for the relative classpath ordeal, it actually IS absolutely necessary, because these packages will be run on different machines, therefore working from the home directory might not always get the compiler to the directory it needs to get to. Working backwards, there is a very strict hierarchy of directories that are meant not to change (as the entire software suite is dependent on this hierarchy staying the same).

Regardless, I tried using an absolute classpath to see if we can find the root of the problem. Indeed, I received an error message, but it was different this time. First I will give the error message. One a side note, there were actually many many error messages, but they were all a result of the original one, however I will provide a small portion of the error messages. You will quickly see that that error messages after the first one are a result of the compiler being unable to find the package within the package being unzipped, and thus cannot find the classes within that package. On my local machine, I unzipped the .jar and went a few levels deep into the package to give you an idea of the package layout so you can better troubleshoot my problem.

The Error(s):

Most importantly, please note line 04 in the error messages above. It says that mapss.dif does not exist!

I explored the package on my local machine (not UNIX) and showed a screen capture of the command prompt below. Please take careful notice of the directories and .class files present.

The mapss package:

I suspect that (if you look at the command prompt image, you will see this) because there are no class files in the dif directory itself, perhaps this is means there is nothing to specify that the dif directory is a package? This is mere speculation.

Please look through the information I have provided carefully before responding. Any help would be appreciated! Thank you.

EDIT: Also, I cannot look at the code within the mapss package. As you can see in the image above, they are all .class files. This code is NOT my own. I am merely testing it. I do not have access to the .java files within the mapss package.
Have you checked out Aspose?
subject: .jar file error opening zip file: Can anyone pinpoint my problem?
It's not a secret anymore!