Error when trying to run Java related commands on MacOS

一笑奈何 提交于 2021-01-29 12:29:50

问题


For example, if I do java -version I get:

Error: dl failure on line 542
Error: failed /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/lib/server/libjvm.dylib, because dlopen(/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/lib/server/libjvm.dylib, 10): no suitable image found.  Did find:
    /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/lib/server/libjvm.dylib: code signature invalid for '/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/lib/server/libjvm.dylib'

What am I to do? I have JDK installed:

Matching Java Virtual Machines (1):
    14, x86_64: "Java SE 14"    /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home

and I've intalled JRE as well though I get the error if I try to invoke java.

My Mac Details:

OS X Yosemite
Version 10.10.5 (14F27)
Processor 2.66 GHz Intel Core 2 Duo

MacBook Pro (15-inch, Mid 2009)


回答1:


That is a fairly old version of OS X with a brand spanking new version of the JDK, which might not have been built in a way intended to be run on that old of a version of OS X. I'd recommend trying out AdoptOpenJDK 8 or 11, and see if things work better there.



来源:https://stackoverflow.com/questions/60868198/error-when-trying-to-run-java-related-commands-on-macos

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