Installing .jar

Wade Chandler wchandler at redesetgrow.com
Tue May 11 13:26:54 UTC 2004


bit wrote:

> Am Dienstag 11 Mai 2004 14:12 schrieb Jason M Evans:
> 
>>Can someone tell me how to install a .jar file?
> 
> 
> I never heard anything about executing a jar file, like another rsponse to yor 
> question said, but the only thing I know about jar is the following:
> It's an archive file (compressed with ZIP)
> 
> So
> to extract do a 
> "jar xf jar-file"
> 
> After that u should have a new dir containig the extracted files.
> 
> bit
> 
> 
I have deleted the original message, so I can't see what the exact post 
was, but .jar isn't only an archive, but is also a java library and can 
be an executable jar.  This means the manifest file will have a line 
Main-Class: com.somecompany.somepackage.SomeClass
where com.somecompany.somepackage.SomeClass is a java application.  To 
launch the .jar file as an executable do
java -jar yourjar.jar.  I have my KDE setup so I can launch .jar files 
with a double click.

If you have an application in the jar file then you need to do something 
like
java -classpath $CLASSPATH:pathToJar/somejar.jar 
com.somecompany.somepackage.SomeClass
which will run the application.  If the application has other jar 
requirements then you'll have to understand more about the classpath.

If this is an application created by someone else surely they have 
documentation on installing or an install script.  If they do not, then 
you need to go to java.sun.com and read up on java a bit.

Now, this jar file could have been created to only be an archive as 
well, and if it is only that, then go to a directory you want it 
extracted to and do:
jar -xvf pathToJar/somejar.jar
It will now extract the archive.

All in all, read up on java and it's tools.  That will help you out.

Wade






More information about the users mailing list