Translation(s): English - EspaƱol


In addition to the normal debhelper packaging tools there are some additional tools specifically for dealing with Java packages.

This page will inform you about common Java packaging workflows in Debian and point you to real-life examples which can be used as a starting point for your own packages.

Contributing to Java packaging

We welcome any help with packaging new applications or libraries and keeping existing ones and their reverse-dependencies up-to-date. These days the easiest way to submit a contribution is via a pull request on Just

  1. make your changes,
  2. document everything in debian/changelog,
  3. set it to UNRELEASED,
  4. test that reverse-dependencies continue to work and then
  5. make a pull request.

Alternatively you can follow the instructions from

which is useful if you also want to learn the general process of uploading a package to Debian. The only change is that you don't have to ask for sponsorship on the mentors mailing list, just use for that.

Java Policy

Java packages in Debian abide like all other packages by the Debian Policy. Java-specific Policy elements are documented in the Debian policy for Java.


Javahelper is Debian's helper tool to perform Java packaging tasks like

It can also help with avoiding patches by creating automatic symlinks to system libraries.

Javahelper is documented in the javahelper package in /usr/share/doc/javahelper/tutorial.txt.gz, also replicated here.

In addition to the tutorial, a talk was given at DebConf10 covering the use of javahelper. The talk is available as:

The idea behind javahelper is that most Java packages should be trivial. The integration with debhelper and the dh sequencer means that you shouldn't need anything in debian/rules, just a few files under the debian directory.

Using javahelper and DH7 ideally your rules file will look like this:

export JAVA_HOME=/usr/lib/jvm/default-java

        dh $@ --with javahelper

All of the work is done by javahelper working from other files under debian/.

Java compilation 101

This section explains the basic terms and methods to compile Java source files into bytecode and the creation of jar files.

When a project has no build system

There are some upstream projects that don't provide a proper build system. In some cases it is useful to download source packages from Maven Central which will come without a build system, just source code. For all those reasons Javahelper is the perfect tool to compile the code and create a proper Debian package. NoBuildSystem examples

Build systems

There are a few build systems in use by Java programs.


If your package uses Ant then debhelper and dh sequencer should automatically detect the build.xml and call things appropriately. Ant examples


Use maven-debian-helper for standard Maven projects, use maven-repo-helper in combination with other build systems to provide Maven artifacts and maven-ant-helper to fallback the build to Ant - usefull mostly for building a library which is part of the Build-Depends of Maven itself. Maven examples


Use gradle-debian-helper. A Gradle project often requires a patch to the build scripts anyway because the build logic varies from project to project. The gradle-debian-helper is currently in an early stage and mostly helps with the substitution of Maven coordinates, so that Gradle will use Debian's local /usr/share/maven-repo instead of downloading build-dependencies from the internet. See also Gradle examples


For autopkgtest is HELP and or information needed ...
Above is bad example, which discussed by:

Frequently asked questions and solutions

The Java Packaging FAQ gives answers to common Java packaging questions, explains some common error messages and provides solutions to fix them.