Skip to main content

Managing Java versions

Abstract

All Bitrise virtual machines have multiple Java versions ready to use.

By default, every Bitrise stack comes with multiple Java versions pre-installed and ready to use. If you do not switch to another version, your build will use the default Java versions.

You can switch between the versions at any time. You can also install a different Java version.

Setting Java version with the Set Java version Step

Each Bitrise stack has multiple different Java versions pre-installed and ready to use. You can easily switch between the different Java versions with our Set Java version Step. The Step allows you to set the global Java version of the virtual machine that runs your build. This Step cannot install any Java version. It can only switch between the versions that are pre-installed on our stacks.

  1. Add the Set Java version Step to your Workflow. We recommend setting it as the first Step of the Workflow.

  2. Find the Java version to be set globally for the build input.

  3. Set it to the version you need.

Example 1. YAML example

In this example, we're setting the Java version to 17 in the bitrise.yml file.

primary:
  steps:
  - set-java-version@1:
      inputs:
      - set_java_version: '17'