---
name: "jh_build"
section: "1"
platform: "linux"
package: "javahelper"
version: "0.80"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/jh_build"
---

# jh\_build(1)

compile java sources in the absence of a (useful) upstream build system

## NAME

jh\_build - compile java sources in the absence of a (useful) upstream build system

## SYNOPSIS

**jh\_build** \[*debhelper options*\]

**jh\_build** \[*debhelper options*\] *jarfile* *source* \[... *source*\]

## DESCRIPTION

## FILES

- debian/javabuild

  A file consisting of each build to perform.  One build per line where each line consists of:

  *jarfile* *source* \[... *source*\]

  Where *jarfile* is the name of the jar file to be built and *source* is a source file or directory containing source files.

## OPTIONS

- **--main=***main-class*

  Set the **Main-Class** attribute in the manifest of the generated jar file(s) to *main-class*. This makes **java -jar** ***generated-jar-file*** run that class.

- **--java-home=***home*

  Use *home* as **JAVA\_HOME** (overrides the **JAVA\_HOME** environment variable).

- **-J**, **--javadoc**, **--no-javadoc**

  Whether or not to build javadoc for the jar files.  The default is to generate javadoc along with the jar files.

- **--javacopts=***options*

  Pass *options* to javac (when invoking javac).  The *options* value is a space-separate list of options (remember to quote the argument to avoid the shell interpreting the value).

- **--javadoc-opts=***options*

  Pass *options* to javadoc (when invoking javadoc).  The *options* value is a space-separate list of options (remember to quote the argument to avoid the shell interpreting the value).

- **--clean**

  If passed, **jh\_build** will clean up after itself.  This is called by [**jh\_clean**(1)](/jh_clean/1.md) and using [**jh\_clean**(1)](/jh_clean/1.md) is recommended over calling **jh\_build** with **--clean** directly.

## ENVIRONMENT

- **JAVA\_HOME**

  If set (and **--java-home** is omitted), it determines the location of the java home for finding the **javac**(1) compiler, **javadoc**(1) compiler and the **jar**(1) utility.

  If the environment variable is unset and **--java-home** is omitted, then the default java home is */usr/lib/jvm/default-java*

- CLASSPATH

  If set, this is the classpath used during compilation of the source code.

- JH\_JAR\_EXTRA

  A space separated list of extra files or directories to include in the generated jar file(s).

  Can be omitted if no extra files need to be included.

## EXAMPLE

```
  jh_build foo.jar src/java/main
```

Will generate **foo.jar** from compiling all the java files in *src/java/main* and generate a javadoc from it.

## SEE ALSO

[**debhelper**(7)](/debhelper/7.md)

This program is a part of javahelper and uses debhelper as backend. There are also tutorials in /usr/share/doc/javahelper.
