Running MacOS 12 on Intel hardware. Current java runtime is Java 8:
Java(TM) SE Runtime Environment (build 1.8.0_341-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.341-b10, mixed mode)
and this is /usr/bin/java
.
For performance measurements, I would like to have also a higher Java version available; currently I’m only interested in JRE, not JDK. I want to see whether the same Java Byte code exhibits different timing und different JRE versions (perhaps due to different garbage collectors?).
My plan was to install a higher Java in, say, $HOME/java
. When I run my application, I can explicitly specify the absolute path to the java I want to run. However I don’t know how to do this. This is how I proceeded:
- I googled for the possibility to download JRE, but didn’t find anything.
- I then found the site http://java.oracle.com/ and it offers only the SDK versions. Well, it’s overkill, but then let’s download the whole SDK. This should also include the runtime.
- I downloaded https://download.oracle.com/java/21/latest/jdk-21_macos-x64_bin.dmg
- I double-clicked the DMG and found inside a file
JDK 21.0.4.pkg
, which seems to be the installer. - Executing the installer, I found that there are written menu entries Instruction, Destination select, Installation type, Installation, but I can not go to the item Destination select. The installation always proceeds directly to Installation type, and offers only the “standard installation” (which most likely means replacing my current Java by the new one).
So I wonder what I can do to have two Javas on my Mac? If I could get from somewhere just the binaries in a zip file, I could unpack them into a directory of my liking ….