mxj with M1-Macs and Rosetta

Alexis Baskind's icon

Dear all,

I have trouble running mxj in Rosetta mode on a M1 Pro Mac (Max 8.2.2, OS 12.0.1), I get the following message in the console:

MXJ System CLASSPATH:
/Applications/Max Intel.app/Contents/Resources/C74/packages/max-mxj/java-classes/lib/jitter.jar
/Applications/Max Intel.app/Contents/Resources/C74/packages/max-mxj/java-classes/lib/jode-1.1.2-pre-embedded.jar
/Applications/Max Intel.app/Contents/Resources/C74/packages/max-mxj/java-classes/lib/max.jar
IVirtual Machine boot
64 bit Architecture detected
MXJClassloader CLASSPATH:
/Applications/Max Intel.app/Contents/Resources/C74/packages/max-mxj/java-classes/classes/
/Users/baskind/Documents/Max 8/Packages/ajm/java-classes/
/Users/baskind/Documents/Max 8/Packages/CNMAT Externals/java-classes/
/Users/baskind/Documents/Max 8/Packages/ejies/java-classes/
/Applications/Max Intel.app/Contents/Resources/C74/packages/max-mxj/java-classes/
/Users/baskind/Documents/Max 8/Packages/op.buffercopy/java-classes/
Cannot get_java_vm
Unable to create JVM


If I start Max on native (arm) mode, it works like a charm. The java installation I'm running is universal binary:
baskind@Alexiss-MacBook-Pro ~ % java --version
java 17.0.2 2022-01-18 LTS
Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)
baskind@Alexiss-MacBook-Pro ~ % file /usr/bin/java
/usr/bin/java: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/java (for architecture x86_64):    Mach-O 64-bit executable x86_64
/usr/bin/java (for architecture arm64e):    Mach-O 64-bit executable arm64e

Please don't tell me to run my patch in native mode, I need Bach and Antescofo, and both are not ported yet for arm64.

Thanks in advance for the help,

Alexis

Alexis Baskind's icon

Update (problem partly solved):

there are two "java" binaries on my machine:
. one in /usr/bin, universal binary, which is actually NOT a java executable, but a launcher for the virtual machines in /Library/Java/JavaVirtualMachines that need to be installed manually (MacOS does not comes with preinstalled java)
. one in /Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home/bin, arm64 only, that I installed myself from the Oracle website. I thought this one was universal binary (and was fooled by the "file /usr/bin/java" command), but it's not.

MXJ works with the binary that responds to "/usr/libexec/java_home", in my case the arm64 binary. This explains why it does not work with Rosetta. I tried to install the x86_64 version of Oracle Java 17.0.2, and I get exactly the opposite result: MXJ works in Rosetta mode, but not in native mode.

So this is pretty consistent and the problem does not come from MXJ but from the java installation. Too bad if we need mxj working in both native and Rosetta mode...

Best

Alexis

nicola privato's icon

Hi Alexis,

same problem here. I don't need mxj to run on arm64, so I'm trying to install the x86_64 version. From the installer it doesn't seem possible though, any info on how to do it would be highly appreciated.

Best
Nicola

Alexis Baskind's icon

Hi Nicola,

it's been a while I did it (one year) and honnestly I forgot. So I tried quickly again: the latest Java 17 installer, version 17.0.6, indeed prevents to install the x86_64 version on a Silicon machine. But not the one I installed, which is the 17.0.2:

https://download.oracle.com/java/17/archive/jdk-17.0.2_macos-x64_bin.dmg

Best regards,

Alexis

nicola privato's icon

Hi Alexis,

this was very helpful, now mxj runs smoothly with Rosetta
thanks a lot!