Unable to change java version

#1

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

0 Likes

#2

Could anyone help?

0 Likes

closed #3

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

0 Likes