- Qbs Manual
- Module java
- Qbs 1.6.0

# Module java

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

## Java Properties

Property | Type | Since | Default | Description
--- | --- | --- | --- | ---
additionalClassPaths | stringList | 1.4 | undefined | Locations beside this product's class output path to consider when compiling.
additionalCompilerFlags | stringList | 1.4 | undefined | Use this to supply compiler flags not covered by any of the properties in this module.
additionalJarFlags | stringList | 1.4 | undefined | Use this to supply archiver flags not covered by any of the properties in this module.
bootClassPaths | stringList | 1.4 | undefined | Use this if you need to specify non-standard bootstrap class files.
compilerFilePath | string | 1.4 | `compilerName`, prefixed by `jdkPath` if it is defined | The command to invoke when compiling Java sources.
compilerName | string | 1.4 | `"javac"` | The file name of the Java compiler.
enableWarnings | bool | 1.4 | `true` | Controls whether warnings are emitted when compiling Java sources.
interpreterFilePath | string | 1.4 | `interpreterName`, prefixed by `jdkPath` if it is defined | The command to invoke when executing Java code.
interpreterName | string | 1.4 | `"java"` | The file name of the Java interpreter.
jarFilePath | string | 1.4 | `jarName`, prefixed by `jdkPath` if it is defined | The command to run when creating or extracting `jar` files.
jarName | string | 1.4 | `"jar"` | The file name of the `jar` tool.
jdkIncludePaths | pathList | 1.4.1 | determined automatically | List of include paths for native header files. Applications using JNI to interface with native code should add these paths to `cpp.includePaths`.
jdkPath | path | 1.4 | determined automatically | 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)
languageVersion | string | 1.4 | undefined | The Java language version to interpret source code as. If undefined, the compiler will use its default.
runtimeVersion | string | 1.4 | undefined | The version of the Java runtime to generate compatible bytecode for. If undefined, the compiler will use its default.
manifest | object | 1.4.2 | undefined | The properties to add to the manifest file when building a JAR. The contents of this property will be aggregated with the values from `manifestFile`. If `manifest` and `manifestFile` contain the same key, the former will take precedence. If undefined, will not be taken into account.
manifestFile | path | 1.4.2 | undefined | The manifest file to embed when building a JAR. The contents of this file will be aggregated with the values in `manifest`. If `manifestFile` and `manifest` contain the same key, the latter will take precedence. If undefined, will not be taken into account.
manifestClassPath | stringList | 1.4.2 | undefined | The entries to add to the manifest's Class-Path when building a JAR.
warningsAsErrors | bool | 1.4 | `false` | If this property is enabled, the compiler will abort where it would normally emit a warning.

## 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.