JAR - is an abbreviation of Java ARchive. Archive is a compressed version of many files, we can say in simple terms.
In order to have a related .class files into one archive file so that maintenance of those files into any application which is in need of it will be easy.
The purposes are
you can load any class from the JAR file
you can use it as a library reference to include the classes which are being imported into an application.
Originally posted by prasanna sheregar: one more doubt, suppose i have A.class,B.class and C.class in a single JAR file which has name XYZ.jar then how can i get only A.class file back
JAR files are a special kind of ZIP files. Using a ZIP application, such as WinZip, TugZIP or Windows XP's built in unpacker, you can easily extract any file from a JAR file.
one more doubt, can we get the java Source code back from a single .Class File?
The original source? No. For instance, all comments will be removed, and sometimes the compiler optimizes code.
Some decompilers do a good enough job though. I've used JADNT in the past with some good result. Still, it is never a replacement for having the original source.
It is also possible to obfuscate compiled code. If this has occurred it is hard, if at all possible, to retrieve its source code.
Final note: decompiling Java classes (or any program for that matter) can be illegal, depending on both the country and the origin of the compiled code. [ November 20, 2007: Message edited by: Rob Prime ]
Simply speaking, its possible through 'Decompilation' through some tools like JAD.
But you got a detailed explanation by Rob.
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
posted
0
A jar is often a "unit of deployment", a bundle of related code that should be released together. In a large system we might find different subsystems and frameworks divided into different jars. And in some environments it is important to be able to deploy one new jar without updating all the others.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
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.