Re: Use of java (specifically on older macOS)

2022-01-03 Thread Gerben Wierda via macports-users
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  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@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@hermione ~ % which java
/usr/bin/java

gerben@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@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@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@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@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@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@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@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@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.



Re: Use of java (specifically on older macOS)

2021-12-14 Thread Steven Smith
Please see https://github.com/macports/macports-ports/pull/13353 
, which sets 
SOLR_JAVA_HOME to accomplish this.

> On Dec 12, 2021, at 6:18 PM, Gerben Wierda via macports-users 
>  wrote:
> 
> Which means that MacPorts solr8 runs using macOS native java and not one from 
> MacPorts itself.



smime.p7s
Description: S/MIME cryptographic signature


Re: Use of java (specifically on older macOS)

2021-12-12 Thread Richard L. Hamilton
BTW, in Xcode.app bundle (12.4),
/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/itms/share/OSGi-Bundles/org.apache.logging.log4j.core-2.11.2.jar

I imagine that will be getting updated not long after they realize it's there.

> On Dec 12, 2021, at 22:02, Steven Smith  wrote:
> 
> Java figures out which version to use from JAVA_HOME or 
> /Library/Java/JavaVirtualMachines. Are you sure that’s not a MacPorts version?
> 
> My native macOS java binary runs the last LTS jdk from MacPorts:
> 
>> sudo -u solr /usr/bin/java -version
>> openjdk version "11.0.13" 2021-10-19
>> OpenJDK Runtime Environment Temurin-11.0.13+8 (build 11.0.13+8)
>> OpenJDK 64-Bit Server VM Temurin-11.0.13+8 (build 11.0.13+8, mixed mode)
> 
> 
> This is a simple path issue because `java` Is found in /usr/bin. If you want 
> to use a MacPorts-installed binary, set up your paths appropriately. I’m not 
> aware of any practical difference this would make.
> 
>> port provides 
>> /Library/Java/JavaVirtualMachines/openjdk11-temurin/Contents/Home/bin/java
>> /Library/Java/JavaVirtualMachines/openjdk11-temurin/Contents/Home/bin/java 
>> is provided by: openjdk11-temurin
> 
> 
> 
>> On Dec 12, 2021, at 18:19, Gerben Wierda via macports-users 
>>  wrote:
>> 
>> Which means that MacPorts solr8 runs using macOS native java and not one 
>> from MacPorts itself. I thought the MacPorts stuff was supposed to be fully 
>> independent (except for Xcode).
> 

-- 
eMail:  mailto:rlha...@smart.net






Re: Use of java (specifically on older macOS)

2021-12-12 Thread Steven Smith
Java figures out which version to use from JAVA_HOME or 
/Library/Java/JavaVirtualMachines. Are you sure that’s not a MacPorts version?

My native macOS java binary runs the last LTS jdk from MacPorts:

> sudo -u solr /usr/bin/java -version
> openjdk version "11.0.13" 2021-10-19
> OpenJDK Runtime Environment Temurin-11.0.13+8 (build 11.0.13+8)
> OpenJDK 64-Bit Server VM Temurin-11.0.13+8 (build 11.0.13+8, mixed mode)


This is a simple path issue because `java` Is found in /usr/bin. If you want to 
use a MacPorts-installed binary, set up your paths appropriately. I’m not aware 
of any practical difference this would make.

> port provides 
> /Library/Java/JavaVirtualMachines/openjdk11-temurin/Contents/Home/bin/java
> /Library/Java/JavaVirtualMachines/openjdk11-temurin/Contents/Home/bin/java is 
> provided by: openjdk11-temurin



> On Dec 12, 2021, at 18:19, Gerben Wierda via macports-users 
>  wrote:
> 
> Which means that MacPorts solr8 runs using macOS native java and not one from 
> MacPorts itself. I thought the MacPorts stuff was supposed to be fully 
> independent (except for Xcode).


Re: Use of java (specifically on older macOS)

2021-12-12 Thread Ryan Schmidt
On Dec 12, 2021, at 19:10, Christopher Chavez wrote:

>> And shouldn’t ports that use java not depend on a java that comes with (old, 
>> outdated) java’s in macOS? But install and use an open source version 
>> instead? Or use the one from Oracle if available?
> 
> Because JDK is not a lightweight dependency, it seems somewhat desirable for 
> ports to be flexible when specifying a Java requirement, and allow using an 
> already-installed JDK/JRE if compatible (including one not provided by 
> MacPorts). The Java PortGroup allows specifying a required Java version 
> (either a minimum version or an exact version), and a fallback JDK port to 
> install if a compatible version isn’t already present (hopefully an LTS 
> version: e.g. 8, 11, or 17 from OpenJDK; other vendors may have LTS for other 
> versions).

The java portgroup and the ability to install java by using MacPorts are 
relatively new capabilities. Not that long ago, everything in MacPorts that 
required java required the user to have installed it manually first. This made 
sense back when java was provided with the OS, but as you say that hasn't been 
the case for over a decade. Probably not all java-using ports have yet been 
updated to use the java portgroup, with I'm not sure what consequences.



Re: Use of java (specifically on older macOS)

2021-12-12 Thread Christopher Chavez
Sent: Monday, December 13, 2021 at 12:18 AM
From: "Gerben Wierda"

> Which means that MacPorts solr8 runs using macOS native java and not one from 
> MacPorts itself. I thought the MacPorts stuff was supposed to be fully 
> independent (except for Xcode).

The JDK ports are an exception in that they install to the usual system-wide 
location of /Library/Java/JavaVirtualMachines rather than in the MacPorts 
prefix. Presumably this is an unavoidable requirement for them to be usable 
system-wide on macOS.


> $ 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)
>  
> $ 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
> 
> $ ls -l 
> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
> -rwxr-xr-x  1 root  wheel  58336 Jul 11 07:48 
> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
> 
> That java is starting to get old, the last update was the last Security 
> Update from macOS Mojave

Your Java 12 installation comes from somewhere else. Apple has not shipped Java 
with/for macOS for a long time. The java, javac, etc. commands present in 
system paths are merely wrappers which require a separately-installed Java 
runtime to do anything useful.


> I also have Oracle Java SE 8 installed:
> 
> $ /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)
> 
> Basically, I am rather confused about java numbering. I know I have the 
> latest Oracle Java install and that my macOS Mojave version had its last 
> update in the summer of 2021. I am also somewhat confused about MacPorts 
> using the standard macOS Java which has a higher number but is an older 
> version.
> 
> Can somebody enlighten me?

macOS will reportedly pick the installation with the latest Java version, 
unless a specific Java version/installation is requested e.g. by the JAVA_HOME 
environment variable.


> And shouldn’t ports that use java not depend on a java that comes with (old, 
> outdated) java’s in macOS? But install and use an open source version 
> instead? Or use the one from Oracle if available?

Because JDK is not a lightweight dependency, it seems somewhat desirable for 
ports to be flexible when specifying a Java requirement, and allow using an 
already-installed JDK/JRE if compatible (including one not provided by 
MacPorts). The Java PortGroup allows specifying a required Java version (either 
a minimum version or an exact version), and a fallback JDK port to install if a 
compatible version isn’t already present (hopefully an LTS version: e.g. 8, 11, 
or 17 from OpenJDK; other vendors may have LTS for other versions).


Christopher A. Chavez


Use of java (specifically on older macOS)

2021-12-12 Thread Gerben Wierda via macports-users
While looking at my systems because of the log4j security issues I noticed the 
following:

I am running solr8 as part of my MacPorts mail server setup and it shows up 
like this:

$ ps laxww|grep java
  504 50615 50613   0  20  0  7594340 1316684 -  S  ??   97:31.56 
/usr/bin/java -server -Xms1g -Xmx1g -XX:+UseG1GC -XX:+PerfDisableSharedMem 
-XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=250 -XX:+UseLargePages 
-XX:+AlwaysPreTouch -XX:+ExplicitGCInvokesConcurrent 
-Xlog:gc*:file=/opt/local/var/solr/logs/solr_gc.log:time,uptime:filecount=9,filesize=20M
 -Dsolr.jetty.inetaccess.includes= -Dsolr.jetty.inetaccess.excludes= 
-Dsolr.log.dir=/opt/local/var/solr/logs -Djetty.port=8983 -DSTOP.PORT=7983 
-DSTOP.KEY=solrrocks -Duser.timezone=UTC -XX:-OmitStackTraceInFastThrow 
-XX:OnOutOfMemoryError=/opt/local/share/java/solr-8.9.0/bin/oom_solr.sh 8983 
/opt/local/var/solr/logs -Djetty.home=/opt/local/share/java/solr-8.9.0/server 
-Dsolr.solr.home=/opt/local/var/solr -Dsolr.data.home=/opt/local/var/db/solr 
-Dsolr.install.dir=/opt/local/share/java/solr-8.9.0 
-Dsolr.default.confdir=/opt/local/share/java/solr-8.9.0/server/solr/configsets/_default/conf
 -Xss256k -jar start.jar --module=http

Which means that MacPorts solr8 runs using macOS native java and not one from 
MacPorts itself. I thought the MacPorts stuff was supposed to be fully 
independent (except for Xcode).

$ 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)

$ 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

$ ls -l 
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
-rwxr-xr-x  1 root  wheel  58336 Jul 11 07:48 
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

That java is starting to get old, the last update was the last Security Update 
from macOS Mojave

I also have Oracle Java SE 8 installed:

$ /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)

Basically, I am rather confused about java numbering. I know I have the latest 
Oracle Java install and that my macOS Mojave version had its last update in the 
summer of 2021. I am also somewhat confused about MacPorts using the standard 
macOS Java which has a higher number but is an older version.

Can somebody enlighten me?

And shouldn’t ports that use java not depend on a java that comes with (old, 
outdated) java’s in macOS? But install and use an open source version instead? 
Or use the one from Oracle if available?

Gerben Wierda (LinkedIn )
R&A IT Strategy  (main site)
Book: Chess and the Art of Enterprise Architecture 
Book: Mastering ArchiMate