2

I'm a bit confused now. When I run the command java --version in the terminal i get: java 13.0.1. When I open the system preferences and click the java app and then about, i see it says Java version 8 1.8.0_231

Does that mean I have 8, 13 or both?

When I check through the java app.

Java app panel

When I check through the terminal.

enter image description here

When i check for all JDK installed on my system (only 1 version pop ups). enter image description here

michaelgz13
  • 45
  • 1
  • 7

3 Answers3

1

You can have multiple JDK installed in one machine but you can have only one version set as default Java SDK. Looks like you have Java 13 set as default.

Try running the following :

echo $JAVA_HOME

You can also go to the tab Java and see the list of all Java Runtime Environments (JRE.)

Please note that just because you have multiple JREs available doesnot mean all corresponding SDK are also there.

royalghost
  • 2,773
  • 5
  • 23
  • 29
0

You can have many version of java on your Mac. But you can run only one of this in a process. On my Mac, system preferences run with java path :

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java

But in terminal, this run with java path:

/usr/bin/java

I think you can replace java file in /usr/bin by another version java you want.

  • So I currently have 2 different java versions installed correct? How do i switch to java 8? – michaelgz13 Feb 12 '20 at 04:37
  • Yes, you can check java version you have in path: /Library/Java/JavaVirtualMachines (i think so). I'm using IDE intellij so switch between it is very flexible. If you want to change version in terminal, this link https://stackoverflow.com/questions/32659348/operation-not-permitted-when-on-root-el-capitan-rootless-disabled will help you to do that. – Thanh Tuấn Feb 12 '20 at 04:52
0

that means you jdk version is 13 , and your jre version is 1.8.

jre is used for running java apps ,and the jdk(java development kit) is for building apps with java language. java jdk is like the android sdk

bigubr
  • 101
  • 1
  • 7