0

My current java version details:-

enter image description here

I followed the steps which are mentioned in the official java web site. Below are related steps screenshot:-

enter image description here

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.

  • Do I need to restart my system?
  • Do I need to perform other steps? If yes, what are those?
wolφi
  • 8,091
  • 2
  • 35
  • 64
pkc456
  • 8,350
  • 38
  • 53
  • 109
  • Instead of downgrading the built-in java, it should be easier to just install a separate instance of an older Java version somewhere else, then configure Jenkins to run using that version explicitly. See: https://serverfault.com/q/858748 – millimoose Jun 07 '18 at 09:27

1 Answers1

4

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.

teppic
  • 7,051
  • 1
  • 29
  • 35
Guilherme Mussi
  • 956
  • 7
  • 14