Reputation: 8516
My current java version details:-
I followed the steps which are mentioned in the official java web site. Below are related steps screenshot:-
After executing these commands, the java version remains the same. I want to downgrade the java version, because I am facing issue with hockey app plugin in jenkins.
Upvotes: 0
Views: 3165
Reputation: 1055
First run /usr/libexec/java_home -V which will output something like the following:
Matching Java Virtual Machines (3):
1.8.0_05, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
1.6.0_65-b14-462, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-462, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
Pick the version you want to be the default (1.6.0_65-b14-462 for arguments sake) then:
export JAVA_HOME=`/usr/libexec/java_home -v 1.6.0_65-b14-462` or you can specify just the major version, if it's unique, like
export JAVA_HOME=`/usr/libexec/java_home -v 1.8` Now when you run java -version you will see:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Just add the export JAVA_HOME… line to your shell’s init file.
Upvotes: 4