# Unable to change java version

**URL:** <https://discuss.bitrise.io/t/unable-to-change-java-version/12527>\
**Category:** Tooling Issues\
**Created:** [April 5, 2020, 11:06am UTC](https://discuss.bitrise.io/t/unable-to-change-java-version/12527 "2020-04-05T11:06:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chinh.ngo](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@chinh.ngo](https://discuss.bitrise.io/u/chinh.ngo)\
**Post date:** [April 5, 2020, 11:06am UTC](https://discuss.bitrise.io/t/unable-to-change-java-version/12527/1 "2020-04-05T11:06:59Z")

</div>

I’m using Script step to excute these line:

```
java -version

brew tap homebrew/cask-versions
brew cask install java11

/usr/libexec/java_home -V

cd /Library/Java/JavaVirtualMachines/
ls
export JAVA_HOME=$(/usr/libexec/java_home -v 11)
echo $JAVA_HOME

java -version

```

But it can not change the version. Here is the log:

```
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)
==> Downloading https://download.oracle.com/java/GA/jdk11/9/GPL/openjdk-11.0.2_osx-x64_bin.tar.gz
==> Verifying SHA-256 checksum for Cask 'java11'.
==> Installing Cask java11
==> Moving Generic Artifact 'jdk-11.0.2.jdk' to '/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk'.
🍺 java11 was successfully installed!
Matching Java Virtual Machines (2):
    11.0.2, x86_64:	"OpenJDK 11.0.2"	/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
    1.8.0_222, x86_64:	"AdoptOpenJDK 8"	/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
adoptopenjdk-8.jdk
openjdk-11.0.2.jdk
/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)

==> Script finished with exit code: 0

```

Please help!

The stack is Mac OS X 10.14.6 x86\_64  
Here is a build link [https://app.bitrise.io/build/f7dd3cb214c487ea#?tab=log](https://app.bitrise.io/build/f7dd3cb214c487ea#?tab=log)

---

<div class="post-metadata">

**Author:** ![chinh.ngo](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@chinh.ngo](https://discuss.bitrise.io/u/chinh.ngo)\
**Post date:** [April 30, 2020, 4:53pm UTC](https://discuss.bitrise.io/t/unable-to-change-java-version/12527/2 "2020-04-30T16:53:02Z")

</div>

Could anyone help?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/d/d901cf2aad020f2dd11918afc89ec2089bb87b35.png) [@system](https://discuss.bitrise.io/u/system)\
**Post date:** [May 30, 2020, 4:53pm UTC](https://discuss.bitrise.io/t/unable-to-change-java-version/12527/3 "2020-05-30T16:53:06Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![cathy.harmon](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/cathy.harmon/32/2674_2.png) [@cathy.harmon](https://discuss.bitrise.io/u/cathy.harmon)\
**Post date:** [October 29, 2020, 5:55pm UTC](https://discuss.bitrise.io/t/unable-to-change-java-version/12527/4 "2020-10-29T17:55:57Z")

</div>

Just wanted to update here with good news! The stacks now have both openjdk 8 and openjdk 11 installed. By default, openjdk 8 will be active. To change to use openjdk 11, you just need a simple script step. Instructions and what needs to be in the script - - all documented in our devcenter!

> **[Virtual machines](https://devcenter.bitrise.io/infrastructure/virtual-machines/#managing-java-versions)**
>
> On bitrise.io, we run your builds on macOS and Linux virtual machines. You can select from multiple stacks, each with its own list of preinstalled tool versions.
