最近买了个 m1 芯片的 mac mini ,我把 MacBook Pro 的数据迁移到了 M1 Mac mini 上,发现在 Mac mini 上运行 java 程序的时候报错。
报错:Failed to write core dump. Core dumps have been disabled. To enable core dumping, try “ulimit -c unlimited” before starting Java again
Build process started. Classpath: /Applications/IntelliJ IDEA.app/Contents/plugins/java/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/tools.jarSLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGFPE (0x8) at pc=0x00000001116d3868, pid=2163, tid=0x000000000000670f
#
# JRE version: Java(TM) SE Runtime Environment (8.0_201-b09) (build 1.8.0_201-b09)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.201-b09 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# j com.sun.tools.javac.comp.ConstFold.fold2(ILcom/sun/tools/javac/code/Type;Lcom/sun/tools/javac/code/Type;)Lcom/sun/tools/javac/code/Type;+877
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/gaohanghang/Library/Caches/JetBrains/IntelliJIdea2020.3/compile-server/hs_err_pid2163.log
Compiled method (c1) 26686 1826 1 java.lang.Integer::intValue (5 bytes)
total in heap [0x0000000111c872d0,0x0000000111c87560] = 656
relocation [0x0000000111c873f8,0x0000000111c87420] = 40
main code [0x0000000111c87420,0x0000000111c874a0] = 128
stub code [0x0000000111c874a0,0x0000000111c87530] = 144
scopes data [0x0000000111c87530,0x0000000111c87538] = 8
scopes pcs [0x0000000111c87538,0x0000000111c87558] = 32
dependencies [0x0000000111c87558,0x0000000111c87560] = 8
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
1. 解决方式
原因是因为 M1 Mac mini 的 M1 芯片使用的是 ARM 架构,需要下载ARM版的JDK。
1.1 安装 ARM 版本 JDK
下载链接:
1.2 idea 选择刚安装的 arm 版本 jdk
完美运行
2. 参考
https://stackoverflow.com/questions/64788005/java-jdk-for-apple-m1-chip
https://www.ithome.com/0/520/136.htm
https://code2care.org/q/install-native-java-jdk-jre-on-apple-silicon-m1-mac