2

I would like to change the current JRE from Version 10.0.1 to some previous versions like 1.8 for instance. At the moment Im confused about my current setting. Basically, Java Panel in System Preferences is telling me that my Java Version is Version 10.0.1 which corresponds to:

 $ /Library/Internet\ Plug- Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

java -version was telling me that:

$ java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

So, I tried to set different versions of my JDK in .bash_profile:

export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA_9_HOME=$(/usr/libexec/java_home -v9)
export JAVA_10_HOME=$(/usr/libexec/java_home -v10)

alias java8='export JAVA_HOME=$JAVA_8_HOME'
alias java9='export JAVA_HOME=$JAVA_9_HOME'
alias java10='export JAVA_HOME=$JAVA_10_HOME'
#default java8
export JAVA_HOME=$JAVA_8_HOME

Where I set the default version to:

java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)

However, that does not change the JRE. I would like to have JRE and JDK the same version (1.8). How can I do that, since one JRE can be installed at a time?

  • What do you mean by "However, that does not change the JRE"? It looks like your java -version command is showing the JRE you asked for. – Bob Jacobsen Jun 13 '18 at 14:46
  • Thats the JRE $ /Library/Internet\ Plug- Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version java version "10.0.1" 2018-04-17 Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode) – Mamba Jun 14 '18 at 15:27
  • Thats the JDK java -version java version "1.8.0_172" Java(TM) SE Runtime Environment (build 1.8.0_172-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode) – Mamba Jun 14 '18 at 15:28
  • They are different – Mamba Jun 14 '18 at 15:28

You must log in to answer this question.

Browse other questions tagged .