- Qbs Manual
- Qbs 1.21.0

# java

Provides Java support. More...

Since: | Qbs 1.4

- List of all members, including inherited members

## Properties

- additionalClassPaths : stringList
- additionalCompilerFlags : stringList
- additionalJarFlags : stringList
- bootClassPaths : stringList
- compilerFilePath : string
- compilerName : string
- enableWarnings : bool
- interpreterFilePath : string
- interpreterName : string
- jarFilePath : string
- jarName : string
- jdkIncludePaths : pathList
- jdkPath : string
- languageVersion : string
- manifest : var
- manifestClassPath : stringList
- runtimeVersion : string
- warningsAsErrors : bool

## Detailed Description

The `java` module contains the properties and rules for building Java projects.

### Relevant File Tags

Tag | Auto-tagged File Names | Since | Description
--- | --- | --- | ---
`"java.class"` | - | 1.4 | This tag is attached to the output artifacts of the rule that runs the `javac` tool.
`"java.jar"` | - | 1.4 | This tag is attached to the output artifacts of the rule that runs the `jar` tool.
`"java.java"` | `*.java` | 1.4 | Source files with this tag serve as inputs to the rule running the `javac` tool.
`"java.manifest"` | `*.mf` | 1.8 | The contents of files with this tag will be aggregated with the values in manifest.

## Property Documentation

additionalClassPaths : stringList

The locations beside this product's class output path to consider when compiling.

Default: Undefined

additionalCompilerFlags : stringList

A list of compiler flags not covered by any of the properties in this module.

Default: Undefined

additionalJarFlags : stringList

A list of archiver flags not covered by any of the properties in this module.

Default: Undefined

bootClassPaths : stringList

A list of non-standard bootstrap class files.

Default: Undefined

compilerFilePath : string

The command to invoke when compiling Java sources.

Default: compilerName, prefixed by jdkPath if it is defined.

compilerName : string

The file name of the Java compiler.

Default: `"javac"`

enableWarnings : bool

Whether warnings are emitted when compiling Java sources.

Default: `true`

interpreterFilePath : string

The command to invoke when executing Java code.

Default: interpreterName, prefixed by jdkPath if it is defined.

interpreterName : string

The file name of the Java interpreter.

Default: `"java"`

jarFilePath : string

The command to run when creating or extracting `jar` files.

Default: jarName, prefixed by jdkPath if it is defined.

jarName : string

The file name of the `jar` tool.

Default: `"jar"`

jdkIncludePaths : pathList

A list of include paths for native header files.

Applications using JNI to interface with native code should add these paths to cpp.includePaths.

Default: Determined automatically.

This property was introduced in Qbs 1.4.1.

jdkPath : string

The base path of the Java Development Kit (JDK).

This is equivalent to the `JAVA_HOME` environment variable, and by default will be determined automatically from one of the following:

- `JAVA_HOME` environment variable (all platforms)
- Registry (Windows)
- `java_home` tool (macOS)
- Known JDK paths (other Unix platforms)

Default: Determined automatically.

languageVersion : string

The Java language version to interpret source code as.

If left undefined, the compiler will use its default.

Default: Undefined

manifest : var

The properties to add to the manifest file when building a JAR.

The contents of this property will be aggregated with the values from any files tagged "java.manifest".

If this property and a manifest file contain the same key, this property will take precedence. If left undefined, this property will not be taken into account.

Default: Undefined

This property was introduced in Qbs 1.4.2.

manifestClassPath : stringList

A list of entries to add to the manifest's Class-Path when building a JAR.

Default: Undefined

runtimeVersion : string

The version of the Java runtime to generate compatible bytecode for.

If left undefined, the compiler will use its default.

Default: Undefined

warningsAsErrors : bool

If this property is `true`, the compiler will abort where it would normally emit a warning.

Default: `false`