John Sobiranski
asked on
Need help understanding a multi-file .jar file
I am having difficulty understanding the logic of a multi-file .jar file. When I looked at the MANIFEST.MF file I found the following code:
Manifest-Version: 1.0
Rsrc-Class-Path: ./ commons-codec-1.7.jar sqljdbc4.jar ojdbc6.jar jt40
0.jar jtds-1.3.1.jar javacsv.jar mail.jar interclient.jar mysql-conne
ctor-java-5.1.26-bin.jar jsch-0.1.51.jar
Class-Path: .
Rsrc-Main-Class: data.main.HalcyonUI
Main-Class: org.eclipse.jdt.internal.j arinjarloa der.JarRsr cLoader
According to the above code, the entry-point to the .jar file is the Java class data.main.HalcyonUI.
When I tried looking at the source code in the eclipse IDE I received the following error message:
The JAR file ~\HalcyonUI.jar has no source attachment. You can attach the source by clicking the source below.
I have attached a copy of the HalcyonUI.class file which is only one of about 100 files that are a part of the HalcyonUI.jar file.
When I looked at the Java code in the HalcyonUI.class file it appears that it is just line numbers and absolutely no object oriented code whatsoever. It does have a main, but the code that follows it looks as if it would not even compile!
The Java code in this .jar file has been in use for several years and is just the tip of the iceberg of the entire program. I have even seen several goto statements in other classes. However, according to the Java documentation on Oracle's site the goto command was removed shortly after James Gosling decided that it was unnecessary.
I would appreciate it if someone could make sense of this spaghetti code because I inherited it by someone who has already left before I inherited it. The code at first sight doe not even appear to run, however it has been running for several years.
I have been programming in Java for many years and I have never run across such horrendous looking code. Please focus on helping me understand how these line numbers and goto statements (in other classes) are even possible in Java and how to follow through the logic this very messy looking code. Thanks.
Manifest-Version: 1.0
Rsrc-Class-Path: ./ commons-codec-1.7.jar sqljdbc4.jar ojdbc6.jar jt40
0.jar jtds-1.3.1.jar javacsv.jar mail.jar interclient.jar mysql-conne
ctor-java-5.1.26-bin.jar jsch-0.1.51.jar
Class-Path: .
Rsrc-Main-Class: data.main.HalcyonUI
Main-Class: org.eclipse.jdt.internal.j
According to the above code, the entry-point to the .jar file is the Java class data.main.HalcyonUI.
When I tried looking at the source code in the eclipse IDE I received the following error message:
The JAR file ~\HalcyonUI.jar has no source attachment. You can attach the source by clicking the source below.
I have attached a copy of the HalcyonUI.class file which is only one of about 100 files that are a part of the HalcyonUI.jar file.
When I looked at the Java code in the HalcyonUI.class file it appears that it is just line numbers and absolutely no object oriented code whatsoever. It does have a main, but the code that follows it looks as if it would not even compile!
The Java code in this .jar file has been in use for several years and is just the tip of the iceberg of the entire program. I have even seen several goto statements in other classes. However, according to the Java documentation on Oracle's site the goto command was removed shortly after James Gosling decided that it was unnecessary.
I would appreciate it if someone could make sense of this spaghetti code because I inherited it by someone who has already left before I inherited it. The code at first sight doe not even appear to run, however it has been running for several years.
I have been programming in Java for many years and I have never run across such horrendous looking code. Please focus on helping me understand how these line numbers and goto statements (in other classes) are even possible in Java and how to follow through the logic this very messy looking code. Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
CEHJ,
Thank you for your astute observation about the .class file.! When I did a search for "Java .class file" I came up with a Wikipedia entry for it. According to Wikipedia a .class file is definitely bytecode that can be executed on the JVM. Thanks for your help!
johnny6
Thank you for your astute observation about the .class file.! When I did a search for "Java .class file" I came up with a Wikipedia entry for it. According to Wikipedia a .class file is definitely bytecode that can be executed on the JVM. Thanks for your help!
johnny6
ASKER
gurpsbassi,
You wrote, "how did you do this? you decompiled the .class file?"
I simply imported the .jar file into eclipse by right clicking on the project name, then select build path, then select Add External Archives, then I opened the file named "Halcyon.jar".
Johnny6
You wrote, "how did you do this? you decompiled the .class file?"
I simply imported the .jar file into eclipse by right clicking on the project name, then select build path, then select Add External Archives, then I opened the file named "Halcyon.jar".
Johnny6
ASKER
Is it possible to turn the .jar file back into the original source code? If so, how?
Is it possible to turn the .jar file back into the original source code? If so, how?My last sentence addresses that
I would look for the source in your VCS system. Hopefully it was version controlled.
ASKER
CEHJ,
I will ask around to find the original source Java code.
Johnny6
I will ask around to find the original source Java code.
Johnny6
ASKER
Excellent answer!
:)
how did you do this? you decompiled the .class file?
Surely you must have the original java source file in a VCS somewhere???