As an intern, I use company code in my projects and they usually send me a jar
file to work with. I add it to the build path
in Eclipse
and usually all is fine and dandy.
However, I got curious to know, what each class contained and when I try to open one of the classes in the jar
file, it tells me that I need a source file.
What does this mean? I come from a C/C++ background so is a jar
similar to an already compiled .o
file and all I can see is the .h
stuff? Or is there actual code in the jar
file that I'm using that's encrypted so I can't read it?
Thanks for all the answers!
Edit:
Thanks, guys, I knew it was a sort of like an archive but I was confused to why when I tried to open the .class
files, I got a bunch of random characters. The output was similar when I tried to open a .o
file in C so I just wanted to make sure.
Thanks!
The JAR file contains the TicTacToe class file and the audio and images directory, as expected. The output also shows that the JAR file contains a default manifest file, META-INF/MANIFEST. MF, which was automatically placed in the archive by the JAR tool.
A JAR file allows Java runtimes to efficiently deploy an entire application, including its classes and their associated resources, in a single request. JAR file elements may be compressed, shortening download times. A JAR file may contain a manifest file, that is located at META-INF/MANIFEST.
jar ) contain your executable classes and resource files. A jar can also contain other jar files, which is useful when your program needs some library which is packaged in a jar.
A library is a more abstract concept, in java, a library is usually packaged as a JAR (Java ARchive), or a collection of JARs. Show activity on this post. A jar file is zip archive containing among other files, the java class files. A Netbeans library contains resources required by the project, including jar files.
A JAR file is actually just a ZIP file. It can contain anything - usually it contains compiled Java code (*.class), but sometimes also Java sourcecode (*.java).
However, Java can be decompiled - in case the developer obfuscated his code you won't get any useful class/function/variable names though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With