jEdit Community home jEdit Community Wiki > Know > Environment Variables > Class Path > JarFiles jEdit Community Wiki webs:
Main | Plugins | Know | TWiki | Sandbox
Know . { Readme | Changes | Index | Search | Go }

Jar files

What is a Jar file?

Java Archives (JAR files) are a special form of the widely used zip file format. On windows, you can even use Win Zip? to browse the contents of a .jar file. This is very useful to make sure that all necessary files were included.

Using Jars

Jar files allow you to bundle all the stuff for you java program into one file. You don't need to extract the jar to use the program. To run a jarred program, simply use java -jar SomeProgram.jar or javaw SomeProgram.jar. You can double click on jar files to run them once you map them to javaw (like when windows askes you what program it should use to run them).

Making your own jar

To make your own jar use jar -c JarName.jar files

Usage: jar {ctxu}[vfm0Mi] [jar-file] [manifest-file] [-C dir] files ...
Options:
    -c  create new archive
    -t  list table of contents for archive
    -x  extract named (or all) files from archive
    -u  update existing archive
    -v  generate verbose output on standard output
    -f  specify archive file name
    -m  include manifest information from specified manifest file
    -0  store only; use no ZIP compression
    -M  do not create a manifest file for the entries
    -i  generate index information for the specified jar files
    -C  change to the specified directory and include the following file
If any file is a directory then it is processed recursively.
The manifest file name and the archive file name needs to be specified
in the same order the 'm' and 'f' flags are specified.

The Manifest file

To allow your jar to be run more easily, use a manifest file (called Manifest) in the base directory of your jar.

It should a line similar to Main-Class: package.subpackage.MainClass and have an extra blank line at the end. For more about the manifest file, see Understanding the Manifest.

Topic JarFiles . { Edit | Attach | Ref-By | Printable | Diffs | r1.1 | More }
Revision r1.1 - 26 Jan 2004 - 16:20 GMT - Brad Mace
Parents: Web Home > Environment Variables > Class Path
Copyright © 1999-2011 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding jEdit Community Wiki? Send feedback.
Get jEdit at !SourceForge.net. Fast, secure and Free Open Source software downloads