Reputation: 6384
Bigger picture: I am trying to get a local version of Jenkins running and per their documentation I need Docker (done) and Java (also done). When I go to run Jenkins I receive a warning that the app requires Java 8.0 or 11.0 and I am running 12.0. I go to Oracle site, download 8.0 version and install. Run Jenkins again, same error.
In Terminal I run:
java -version
which returns:
openjdk version "12.0.1" 2019-04-16
I then check to see what versions of Java I have installed.
/usr/libexec/java_home -V
which returns
Matching Java Virtual Machines (2):
12.0.1, x86_64: "OpenJDK 12.0.1" /Library/Java/JavaVirtualMachines/openjdk-12.0.1.jdk/Contents/Home
1.8.0_221, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/openjdk-12.0.1.jdk/Contents/Home
I then run:
export JAVA_HOME='/usr/libexec/java_home -v 1.8'
and
java -version
which returns
openjdk version "12.0.1" 2019-04-16
why did the default Java not switch to Java SE 8?
I can work somewhat with the command line but it is not really my area of competency, so be patient. : ) Thanks in advance for any help.
Upvotes: 0
Views: 256
Reputation: 6384
Solved it, posting here for others:
I added
export JAVA_HOME='/usr/libexec/java_home -v 1.8'
to my bash_profile file then ran
source bash_profile
then checking Java version showed the correct one. Only do this if you want to permanently change the default Java.
Upvotes: 1