简体   繁体   中英

Apple silicon(M1) 11.4 get a java error (jdk16)

A fatal error has been detected by the Java Runtime Environment:

Internal Error (sharedRuntime.cpp:531), pid=2424, tid=7427

Error: ShouldNotReachHere()

JRE version: OpenJDK Runtime Environment (16.0+14) (build 16+14)

Java VM: OpenJDK 64-Bit Server VM (16+14, mixed mode, tiered, compressed oops, g1 gc, bsd-aarch64)

No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

If you would like to submit a bug report, please visit: https://bugreport.java.com/bugreport/crash.jsp

--------------- TH R EAD --------------- Current thread (0x000000015400be00): JavaThread "main" [_thread_in_Java, id=7427, stack(0x000000016d7b0000,0x000000016d9b3000)] Stack: [0x000000016d7b0000,0x000000016d9b3000], sp=0x000000016d9b1750, free space=2053k Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.dylib+0x9b4130] VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x46c V [libjvm.dylib+0x9b4884] VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, char*)+0x40 V [libjvm.dylib+0x2ad690] report_vm_error(char const*, int, char const*, char const*, ...)+0x5c V [libjvm.dylib+0x2ad864] report_should_not_reach_here(char const*, int)+0x2c V [libjvm.dylib+0x818d4c] SharedRuntime::raw_exception_handler_for_return_address(JavaThread*, unsigned char*)+0x178 V [libjvm.dylib+0x818df0] SharedRuntime::exception_handler_for_return_address(JavaThread*, unsigned char*)+0x28 v ~StubRoutines::forward exception j java.lang.Class.forName(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;+43 java.base@16...

Error happens even I reinstall MacOS:

  1. JDK16 installed via brew
  2. JDK16 installed via Zulu
  3. JDK17 installed via Zulu

But it works well:

  1. JDK15 installed via Zulu

Someone says that everything is fine with JDK16(Zulu), and I don't know why.

Using the java11 / openjdk@11 brew formula got me going for now.

Did a bit more digging and saw this referenced over at the openjdk issue tracker: https://bugs.openjdk.java.net/browse/JDK-8267235

There is currently a github issue over at https://github.com/Homebrew/homebrew-core/issues/77954 reporting the issue for what is installed by the brew formula itself. It looks like there may be some pull requests already so expect it to be resolved soon.

If you have installed via brew then by running brew upgrade fixed my issue.

The mvn formula in brew seems to prefer always using openjdk formula even with openjdk@11 installed. I ended up setting JAVA_HOME , which mvn will use, to solve this problem along with installing Zulu 11 at /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home .

# Ensure JAVA_HOME is set for mvn since JAVA_HOME will take precedence over homebrew dependency
export JAVA_HOME=$(/usr/libexec/java_home)

I agree with Ben Mayes, use Java 11. I would like to provide a detailed description of how to do this, for beginners like me.

Step 1: Go to this page to download Java 11. Near the bottom of the page, you will select which version of Java to download. For operating system, choose macOS. For architecture, choose ARM 64-bit. For Java package, choose JDK. Then, choose the.dmg option below to download. Double click on the.dmg file to install it.

Step 2: Follow this tutorial . The only thing I really had to change was using the.zshrc profile instead of the.bash profile. This will be the name of the version you will use: zulu-11.jdk.

This will be the text you put in the.zshrc file you have:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home

Step 3: If you are using intelliJ or another IDE, you might need to change the version that the project is using. Follow this tutorial on how to do that.

Had this issue in my Mac m1 machine.. just ran this command brew upgrade and my issue got resolved

Tried all the answers but the arm version of the sdk didnt seem to work, ironically the x86 version of the sdk did the job for me. https://www.azul.com/downloads/?os=macos&architecture=x86-64-bit&package=jdk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM