Use of java (specifically on older macOS)

Gerben Wierda gerben.wierda at rna.nl
Tue Jan 4 01:30:22 UTC 2022


I’m getting back to this because (a) I’m still confused and (b) I had a local disaster which kept me form getting back to it

> On 13 Dec 2021, at 04:02, Steven Smith <steve.t.smith at gmail.com> wrote:
> 
> Java figures out which version to use from JAVA_HOME or /Library/Java/JavaVirtualMachines. Are you sure that’s not a MacPorts version?

Actually, both my machines have Oracle Java 8 version 311 installed it turns out. On both systems the Java panel started via System Preferences says it is “Java 8 version 311”. This version, it seems, will get Oracle patches until 2030 (https://en.wikipedia.org/wiki/Java_version_history). But these are only installed as Internet Plugins

gerben at hermione Contents % /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version 
java version "1.8.0_311"
Java(TM) SE Runtime Environment (build 1.8.0_311-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode)

Neither machine has MacPorts openjdk so far. I was asking all of this because I was looking into my Java situation. 

But...

on Mojave:
albus:~sysbh$ which java
/usr/bin/java

albus:~ sysbh$ `which java` -version
java version "12.0.2" 2019-07-16
Java(TM) SE Runtime Environment (build 12.0.2+10)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

albus:~ sysbh$ ls -l /usr/bin/java
lrwxr-xr-x  1 root  wheel  74 Aug 10  2019 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

(10 aug 2019 last symlink creation. By whom? My guess was this was still Apple)

albus:~ sysbh$ ls -l /Library/Java/JavaVirtualMachines/
total 0
drwxr-xr-x  3 root  wheel  96 Sep  8  2019 jdk-12.0.2.jdk


on Catalina:
gerben at hermione ~ % which java
/usr/bin/java

gerben at hermione ~ % `which java` -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

gerben at hermione ~ % ls -l /usr/bin/java
lrwxr-xr-x  1 root  wheel  74 Jan  2  2021 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

(Jan 2 2021 last symlink creation. By whom? My guess: still Apple)

gerben at hermione ~ % ls -l /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
-rwxr-xr-x  1 root  wheel  38880 Sep 21  2020 /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

gerben at hermione ~ % ls -l /Library/Java/JavaVirtualMachines 
total 0
drwxr-xr-x@ 3 root  wheel  96 Aug 24  2013 jdk1.7.0_25.jdk

Now I am completely confused. Both systems should have Oracle Java 8 installed, version 311. But the older system has Java 12 and the newer system has Java 7??

But it doesn’t explain stuff like a Sep 21 2020 java binary that is version 7.

And both are not the same binary:

gerben at hermione Contents % /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
gerben at hermione Contents % /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java -version 
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
gerben at hermione Contents % cmp /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java differ: char 12, line 1

So far my guess is that those non-recently-updated-Oracle-java8’s are leftovers, e.g. from older iTunes-related software (which, as it was for both Windows and macOS was probably fully java).

One of those leftovers has been picked up as the java to use by MacPorts apache-solr8

Basically, this means I probably should try to clean out those old java’s and make sure solr8 uses a recent one. Maybe move to openjdk via MacPorts.

G

PS. Apple still ships (embedded) javas. E.g.

gerben at hermione ~ % /Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/itms/java/bin/java -version
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment 14.0.2-5906ce1373 (build 14.0.2+12-iTunesOpenJDK-5)
OpenJDK 64-Bit Server VM 14.0.2-5906ce1373 (build 14.0.2+12-iTunesOpenJDK-5, mixed mode)

or 

gerben at hermione ~ % '/Applications/iTunes Producer.app/Contents/itms/java/bin/java' -version
openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-root_2015_05_12_09_52-b00)
OpenJDK 64-Bit Server VM (build 24.80-b07, mixed mode)

(That one also has an older log4j…). Seems even Apple has its problems with LCM.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20220104/147b50b8/attachment.htm>


More information about the macports-users mailing list