mac下idea启动spring工程报错,之前mac本上可以运行

今天使用公司电脑运行之前的一个springboot的工程,结果启动报错,报的错还很奇怪

image

报错信息:


Build process started. Classpath: /Applications/IntelliJ IDEA 2020.3.app/Contents/plugins/java/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/lib/tools.jar

SLF4J: 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](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=0x00000001116cf868, pid=23180, tid=0x00000000000038ab

JRE version: Java(TM) SE Runtime Environment (8.0_192-b12) (build 1.8.0_192-b12)

Java VM: Java HotSpot(TM) 64-Bit Server VM (25.192-b12 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/***/Library/Caches/JetBrains/IntelliJIdea2020.3/compile-server/hs_err_pid23180.log

Compiled method (c1) 31734 1588  1  java.lang.Integer::intValue (5 bytes)

total in heap [0x0000000111bb74d0,0x0000000111bb7760] = 656

relocation  [0x0000000111bb75f8,0x0000000111bb7620] = 40

main code  [0x0000000111bb7620,0x0000000111bb76a0] = 128

stub code  [0x0000000111bb76a0,0x0000000111bb7730] = 144

scopes data  [0x0000000111bb7730,0x0000000111bb7738] = 8

scopes pcs  [0x0000000111bb7738,0x0000000111bb7758] = 32

dependencies [0x0000000111bb7758,0x0000000111bb7760] = 8

If you would like to submit a bug report, please visit:

[http://bugreport.java.com/bugreport/crash.jsp](http://bugreport.java.com/bugreport/crash.jsp)

后来在StackOverflow上找到一个答案感觉比较靠谱,说的是mac新的m1的芯片不支持mac电脑自带的oracle的jdk1.8,需要下载zulu的jdk1.8。因为m1芯片是arm架构。

解决办法:
安装zulu版的jdk1.8,然后在idea的project structure里面更改项目使用的SDK版本,选择zulu jdk1.8。
zulu jdk下载链接:https://www.azul.com/downloads/zulu-community/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk
网站下载的zulu版的jdk选择dmg形式的,然后双击安装就可以了,mac下默认Java虚拟机的安装路径是/Library/Java/JavaVirtualMachines。然后更改项目使用的SDK版本,File -> Project Structure -> Project -> Project SDK。点击NEW,然后点击+JDK的时候路径选择一直到/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home这一级就可以了。

image
image

修改之后启动成功:

image.png

你可能感兴趣的:(mac下idea启动spring工程报错,之前mac本上可以运行)