Java/JDK for Apple M1 chip?

三世轮回 提交于 2021-02-05 17:49:44

问题


Will there need to be a special release of OpenJDK to support the new Apple M1 chip?

I see that there are currently downloads of the JDK for macOS/OS X, but these seem to only be for x86 processors. Is that correct? If so, where can I download a version of OpenJDK for the M1?


回答1:


Yes.

On this page: AdoptOpenJDK Latest Releases you can select 'macOS' from the 'Operating System' dropdown, and then from 'Architecture', it's currently only x64, but soonish there should be AArch64 or ARM64 (those are usually the shortcodes for 64-bit ARM). Possibly, as apple no doubt has a bunch of extensions built into their M1 designs, apple gets its own.

If you instead leave Operation System on 'any', you'll note aarch64 is in there, and this gets you to a linux release for ARM processors. That (probably) won't run on MacOS on M1 hardware, but that's 95% of the work already done.

So: It's not there yet, but note that JDKs for ARM have been available for decade+, and whilst JDK15 has dropped support for a bunch of exotic OS/arch combos (such as solaris), ARM dev has always remained at least partially relevant (even if so far it's mostly an oracle commercial license offering). That is to say: It should not be a herculean effort to create an adoptopenjdk release that runs on M1s natively, so presumably, it will happen. But, it's open source effort, so if you're anxious, by all means, read up and contribute :)

Apple has not given any details on this architecture whatsoever until november 10th 2020, unless you bought a devkit box for it (an apple mini with an A14 chip, which isn't an M1 chip, but close enough I guess), and signed a big NDA.

As a rule, open source projects will run as fast as possible in the opposite direction if you wave an NDA around, so if you dislike this state of affairs, I don't think it's wise to complain to adoptopenjdk or other packagers and open source projects about it :)

Fortunately, now it's out, and an NDA is no longer required. My assumption is that the ARM branch of the OpenJDK sourcecode + the macos bits that already exist for the macos-x64 release can be combined rather easily once someone with some familiarity with the openjdk sourcecode has an M1-based macos system to test it on, which should mean an adoptopenjdk macos-aarch64 release should be here within the month.

But, open source. You didn't pay them, you have no contract, and they don't owe it to you. Donate to the effort or contribute a pull request if you want it to go faster.

UPDATE:

  • Azul's M1 OpenJDK builds
  • Microsoft's (yes, really) github source repo for an early access OpenJDK16 build for MacOS on AArch64. Note that microsoft's been working on the openjdk branch of AArch64 (for ARM-based windows 10) for a while, which goes back to: A lot of the hard work was already done.



回答2:


Azul is offering MacOS ARM builds of OpenJDK on their website in the Downloads section. I haven’t tried them out yet though, but Azul have been long-time JDK developers.

Update: Once you unpack the Azul JDK, you have to rummage around inside of it until you find the zulu-11.jdk directory (assuming you've downloaded jdk11), which you then copy to /Library/Java/JavaVirtualMachines




回答3:


I am successfully developing Java applications on the new Apple M1 Chip with Azul OpenJDK and Netbeans.

Configuration: zulu16.0.65-ea-jdk16.0.0-ea.24-macos_aarch64 Netbeans 12.1 and maven.




回答4:


It's not just JEP-391. There is a preview branch - https://github.com/openjdk/jdk-sandbox/tree/JEP-391-branch

one can build 16-ea using cross-compilation on intel mac or directly on arm mac and it runs fine




回答5:


Microsoft/Azul appear to be prime movers on jep-391 in combination with the Windows port (jep-388). They have a separate github repository that actually has an EA release for macOS-aarch64.

Not sure what exact relationship is with openjdk repo.




回答6:


Please go to Azul site and download dmg

https://www.azul.com/downloads/zulu-community/?os=macos&architecture=arm-64-bit&package=jdk

This will be placed in library and once IntelliJ identifies it, it should be good to run



来源:https://stackoverflow.com/questions/64788005/java-jdk-for-apple-m1-chip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!