4

Following the posts here and here, I had to have two different versions of Java/OpenJDK installed

brew install java
brew cask install java

now I have openjdk 13.0.2

openjdk 13.0.2 2020-01-14
OpenJDK Runtime Environment (build 13.0.2+8)
OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)

in two different locations

  • /usr/local/opt/openjdk/bin
  • /usr/local/opt/openjdk/libexec/openjdk.jdk/Contents/Home/bin/

and openjdk 14

openjdk 14 2020-03-17
OpenJDK Runtime Environment (build 14+36-1461)
OpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)

also in two different locations

  • /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/
  • /Library/Java/JavaVirtualMachines/openjdk-14.jdk/Contents/Home/bin/

so my questions are

  • why there are two different locations for each installation of OpenJDK?
  • how to find out if there are more installations of JDK on my system? Ran sudo find / -name java which nuked my terminal (see log here).
  • How to know how those different versions of java are installed?
  • I understand that JDK is Java SDK and JRE (Java Runtime Environment) is an oracle thing which I think OpenJDK doesn't have (?) but looking at OpenJDK download page what are "JMC" and "Java SE"?!
Foad S. Farimani
  • 12,396
  • 15
  • 78
  • 193

1 Answers1

2

what you are seeing is the way that a JDK works on macOS. but basically what you should know that we have two entities called JDK and JRE. JDK is a tool for java developers to compile and run their applications. JRE is a runtime for clients to run java applications. JDK is containing a JRE, so you don't need to install JRE when you have JDK.

A JDK is a folder that you can have based on your OS and copy paste it every where that you need and just add the bin folder to your PATH . so you might have lot of JDK folders but only the one that is added to your PATH is your current working JDK, and they are not working at the same time in one environment but you can have multiple Java versions on different user profiles.

  1. what you have is one installation with its meta data and links all over the macOS.
  2. you can have multiple JDK folders all around your hard disk but only one of them at the current time is working and that would be the one that you have in the user profile.
  3. I don't know a way to find out how they are installed. you can query the tools like brew in your os to find out that if they installed any java or not but not from JDK itself.
  4. JMC is java mission control which is a monitoring application for java application. JRE, as I said, is a runtime for running the applications and OpenJDK also includes a runtime in itself. JavaSE is the specification of Java for Standard edition since we have other editions too.