Issue
I am trying to get a Java/Maven project working on an Apple M1 with a dependency that is not yet available for the M1 chip. In my case this is nd4j but it could be any other dependency.
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native</artifactId>
<version>1.0.0-beta7</version>
</dependency>
I am using IntelliJ for this project.
I am looking for a way to specify some sort of "compatibility mode" that tells maven/IntelliJ to fetch dependencies for X86 chips and execute Java, the tests, maven, etc. with Rosetta. If that's not possible, what could be other was to solve this?
Solution
You can install both x86_64 based and arm64 based JDKs on your machine, and switch between these as needed. A tool like SDKMAN! can help you with that: How to install x86 and Arm JDKs on the Mac M1
If your maven and IntelliJ use the default JDK, they will automatically switch between x86_64 and Arm64 architecture, when you switch JDKs.
Answered By - Mario Varchmin
Answer Checked By - Marilyn (JavaFixing Volunteer)