Skip to content

2020Media

 

Newsflash

Block your brand from becoming a .xxx Find out more.
 
You are here: Home arrow Tools arrow Reference arrow Jars and Wars
Jars and Wars PDF Print E-mail

A jar file is simply a collection of classes that are packaged together for easy of distribution. A war file is pretty much the same thing for web applications. You put jar files into the classpath of applications in order to use whats in them. Similarly you deploy a war file into the webapps directory of a java servelt container in order to deploy it as a web app.

The basic jar syntax is;

jar -[options] jar-file input-file(s)

example
jar -cvf jam.jar *.*

The above options are defined as;

- c – create
- v – verbose
- f – file

The name of the jar file is jam.jar and the files used to create this jar file are basically everthing in the current directory (*.*).

You can also extract a jar file using the option “x” (extract)

example
jar -xvf jam.jar *.*

Finally to view the contents of a jar file use the “t” option.

example
jar -tvf jam.jar

A  war file is pretty created in exactly the same way. All you need to do is create a file with a  .war extension rather than a .jar extension.

example
jar -cvf jam.war *.*

 
< Prev   Next >
Advertisement

Domain Search

Preferred Extensions -
.com .co.uk
.net .org
.me .eu
[+]
  • Narrow screen resolution
  • Wide screen resolution
  • Auto width resolution
  • Increase font size
  • Decrease font size
  • Default font size