PDA

Click to See Complete Forum and Search --> : what is a JAR file?


CaptainPinko
Dec 2nd, 2001, 12:37 PM
what is a JAR file? I know it stands for Java ARchive <i think:confused:> but does [B]THAT[\B] mean and what is its purpose

Dillinger4
Dec 2nd, 2001, 03:29 PM
Im not too sure so don't quote me on this. A JAR file is basically used to group your classes togther for furture deployment. I don't think that there is any automatic installation involved like there is using Visual Basics Package and Deployment wizard. Most people zip up(compress) their JAR files for subsequent extraction. I haven't really coded anything yet that i would want to deploy. Most of my projects are unfinished.

CaptainPinko
Dec 2nd, 2001, 03:32 PM
Originally posted by Dilenger4
Most of my projects are unfinished. [/B]

Ain't that the truth eh!
Is there anyway to unJAR a JAR?

Dillinger4
Dec 2nd, 2001, 03:38 PM
You guess is as good as mine. :D

tcullen
Dec 2nd, 2001, 03:58 PM
JAR = Java Archive File where all files are compressed ready for deployment.

I think you can work on them if you have something like JBuilder Enterprise or Pro

Amazing my first reply on a subject i thought i knew nothing about:cool:

Dillinger4
Dec 2nd, 2001, 04:00 PM
But is the compression automatic? Or do we have to manually do it with win zip of another compresion utillity? Thanks.

Cudabean
Dec 2nd, 2001, 06:30 PM
jar files are neat. They save space and make your finished project easy to deploy. Ideally, when you distribute your product it will consist entirely of jar files. All of the files that you yourself created will generally reside in one jar file, while all of the other packages written by others will reside in their respective jar files.

Jar files are easy to manipulate. The syntax is very similar to unix tar (tape archive).

On the command line to create a jar file, you'd say:
jar -cvf myjar.jar *.class
c, v and f are independent options.
c means create the archive
v means verify (show me) each argument that is going into it
f means the archive filename will appear next.

There is also a manifest file option. I'm not sure what it is exactly, but we don't use it. I think it's a file that tells about all the classes in the archive, but I'm not exactly sure why.

jar files are compatible with the zip format so you can unzip a jar. I wouldn't suggest making a jar with zip just to be on the safe side.

Another thing--if you want to see all the classes that are in your jar or somebody else's jar try:
jar -tf other.jar

You can even extract all the classes by typing
jar -xvf other.jar

Because java classes are wonderfully small to begin with, we don't bother with compressing our jars. From our perspective, a compressed jar is less desirable because of the decreased speed of decompressing it.

Marlin