Skip to main content
$JAVA HOME missing on Ubuntu
Updated over a week ago

Issue:

The $JAVA_HOME Environment Variable (Env Var) is not set on Bitrise's Linux stacks.

The solution:

The $JAVA_HOME Env Var does not need to be set on our Linux stacks. If you are referencing other java binaries in your runtime environment, you may need to set it.

To set the $JAVA_HOME Env Var to the JRE for the system's active Java version, add the following in a Script Step.

envman add --key JAVA_HOME --value "$(dirname -- "$(dirname -- "$(readlink -f /usr/bin/java)")")"

It's important that you do not set this Env Var to an absolute path as any change in the preinstalled Java version will break the Workflow if it depends on this Env Var being set.

Did this answer your question?