Home :: Download :: Installation :: Usage :: To be done

The Jarpend Project



N   E   W   S

2003-10-22 Jarpend released. A batchfile for Windows users is included from now on.
2003-10-04 Here we go. I'm happy to announce the first public version of Jarpend. It looks pretty stable to me, but a little beta testing won't hurt. So please use it and inform me about bugs. If you think, something could be done better, feel free to contact me, too.



Project Goal

The goal of the Jarpend Project is to provide tools concerning dependency checking for Java. It provides a tool called jarpend, that allows you to test whether a certain classpath fulfills the requirements of a given set of classes and to build a JAR file containing only the required classes. You can use it through a command line interface or as an Ant Task. Of course this is an Open Source Project. It is covered by a BSD-style License and hosted at

The jar creation feature is especially useful in situations when bandwidth is a concern, e.g. applets. Imagine an applet using only some classes provided in a huge jar with hundreds or more classes. On the one hand you could put all classes from the library jar into your applet jar, creating a very big applet, that is almost impossible to use with a slow connection. On the other hand you could try to determine the necessary classes and put them into your applet jar by yourself. A complicated and boring task for a human. Or you could use Jarpend, doing the dirty work for you, every time you build your app.

The validation feature is interesting for people deploying applications consisting of multiple jars. If only one of them is missing or not up to date, some class might have been forgotten. A bug that would only appear at runtime, crashing the whole application.

The tool is written in Java and provides a jar like command line interface and ant task, so it can be smoothly integrated into Ant build files.

jarpend- 478 KB MD5 32e33593293272ade0b4e1db8970c5b8
jarpend- 616 KB MD5 8928b96d50f90fae2ec40e089483d763

Jarpend needs a JDK 1.4.1. Actually it is just tested on a FreeBSD 5.1 but there seems to be no reason why you would have problems on other platforms.
Just download one of the distributions above, unzip, untar and move them, where you like your apps. You're almost ready now. There is a shell script for *N*X users to make life a little more comfortable. Chmod it to executable and adjust the JARPEND_HOME environment variable to the absolute path of your installation directory. Type jarpend --version to see if it worked. Maybe you want to adjust your PATH.


As already mentioned, jarpend can be called in two different ways, from the command line or from an ant build file through the jarpend task. Most options are the same for both ways, just how you set them differs.

This is a list of parameters you must/can set.

  • The classes whose dependecies shall be tested (mandatory).
  • What to do, e.g. create a jar containing all required classes, or just validate, that they are all in your classpath (mandatory).
  • The classpath to work on. If not specified, the jarpends classpath will be used.
  • A set of packages, that shall be excluded. You don't need to specify java and javax here, they will be excluded by default.
  • A set of regular expressions. If the fully qulaified classname of a class matches one of these expressions, it will be ignored.
  • The name of the jar file. (Only in case you want to create a jar.)

There are also some options, that are a little exotic, so may be you will never need them.

  • In some cases you might want to ignore unfulfilled dependencies.
  • Include classes from java/javax packages. If you include those classes in a jar, consider your JRE's licensing conditions.
  • Include classes that have a strange name e.g. containing closing braces (like ]). The BCEL sometimes returns these strange named classes. Not sure if it's a bug in BCEL or in jarpend, so this behaviour can be turned off.

All these options and parameters, can be set by the command line tool in the following way:

jarpend [options] [-l | -c [-f <my.jar>]] <class1>> [<class2>]
  -c, --create
          Use this to create a jar containing the dependent classes.
  -f, --file
          Specify the jar file, if omitted System.out will be used.
  -l, --list
          Causes jarpend to list all dependent classes.
  -p, --classpath 
          Specify the classpath on which the dependency check will perform.
          If omitted, current JVM's classpath will be used.
  -e, --exclude-packages <name1> [<name2> [<name3> ..]]
          Exclude packages beginning with one of the given names. You don't
          need to list java[x] here, they will be excluded by default. Look
          at the --include-default-java-classes option.
  -x, --exclude-classes <RE1> [<RE2> [<RE3> ..]]
          Exclude classes matching one of the given regular expressions
  -i, --ignore-unfulfilled-dependecies
          jarpend won't exit when the dependencies for a class are not met
  -j, --include-default-java-classes
          jarpend will include the classes in java and javax. Before
          enabling this, consider the license of your JDK/JRE.
  -s, --test-strange-named-classes
          Some classes list strange references, at least BCEL lists them.
          They will be ignored by default. Use this change this behaviour.
          Prints the version number and exits.
          Prints licensing information and exits.

If you just want to test, specify neither the create option nor the list option.

To be done

You're welcome to contribute to the project. Here are some things that are on my list. If you have any patches, suggestions or time to work on this, let me know.

  • complete the documention
  • testing






   Last update 2003-10-22