我在macOS中安装了Intellj 15。运行时会引发以下错误。
$ /Applications/IntelliJ\ IDEA\ 15\ CE.app/Contents/MacOS/idea
2016-05-21 18:07:53.774 idea[1307:51782] Value of IDEA_JDK: (null)
2016-05-21 18:07:53.778 idea[1307:51795] fullFileName is: /Applications/IntelliJ IDEA 15 CE.app/Contents/bin/idea.vmoptions
2016-05-21 18:07:53.778 idea[1307:51795] fullFileName exists: /Applications/IntelliJ IDEA 15 CE.app/Contents/bin/idea.vmoptions
2016-05-21 18:07:53.778 idea[1307:51795] Value of IDEA_VM_OPTIONS is (null)
2016-05-21 18:07:53.778 idea[1307:51795] Processing VMOptions file at /Applications/IntelliJ IDEA 15 CE.app/Contents/bin/idea.vmoptions
2016-05-21 18:07:53.779 idea[1307:51795] Done
Error: could not find libjava.dylib
Failed to GetJREPath()
2016-05-21 18:07:53.779 idea[1307:51795] JNI_CreateJavaVM (/Applications/IntelliJ IDEA 15 CE.app/Contents/jre/jdk) failed: 4294967295
我将JAVA_HOME设置为
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/"
我在
libjava.dylib
中有/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/
。另外,我在
libjava.dylib
中有/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/
$ ll /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/
total 251384
drwxrwxr-x 2 root wheel 68 Feb 1 22:02 applet
-rw-rw-r-- 1 root wheel 1378 Dec 22 18:26 calendars.properties
-rw-rw-r-- 1 root wheel 3133473 Dec 22 18:26 charsets.jar
-rw-rw-r-- 1 root wheel 72450 Dec 22 18:26 classlist
drwxrwxr-x 7 root wheel 238 Feb 1 22:02 cmm
-rw-rw-r-- 1 root wheel 5916 Dec 22 18:26 content-types.properties
-rw-rw-r-- 1 root wheel 4122 Dec 22 18:26 currency.data
drwxrwxr-x 24 root wheel 816 Feb 1 22:02 deploy
-rw-rw-r-- 1 root wheel 2218758 Dec 22 18:28 deploy.jar
drwxrwxr-x 13 root wheel 442 Feb 1 22:02 ext
-rw-rw-r-- 1 root wheel 4116 Dec 22 18:26 flavormap.properties
-rw-rw-r-- 1 root wheel 3058 Dec 22 18:26 fontconfig.bfc
-rw-rw-r-- 1 root wheel 8087 Dec 22 18:26 fontconfig.properties.src
drwxrwxr-x 11 root wheel 374 Feb 1 22:02 fonts
-rw-rw-r-- 1 root wheel 13962 Dec 22 18:26 hijrah-config-umalqura.properties
drwxrwxr-x 3 root wheel 102 Oct 6 2015 images
-rw-rw-r-- 1 root wheel 55 Dec 22 16:03 javafx.properties
-rw-rw-r-- 1 root wheel 471677 Dec 22 18:28 javaws.jar
-rw-rw-r-- 1 root wheel 114950 Dec 22 18:26 jce.jar
drwxrwxr-x 4 root wheel 136 Feb 1 22:02 jfr
-rw-rw-r-- 1 root wheel 560452 Dec 22 18:26 jfr.jar
-rw-rw-r-- 1 root wheel 33930 Dec 22 16:03 jfxswt.jar
drwxrwxr-x 3 root wheel 102 Feb 1 22:02 jli
-rwxrwxr-x 1 root wheel 15136 Dec 22 18:26 jspawnhelper
-rw-rw-r-- 1 root wheel 633834 Dec 22 18:26 jsse.jar
-rw-rw-r-- 1 root wheel 624 Dec 22 18:26 jvm.cfg
-rw-rw-r-- 1 root wheel 4226 Dec 22 18:26 jvm.hprof.txt
-rw-rw-r-- 1 root wheel 45120 Dec 22 18:26 libAppleScriptEngine.dylib
-rw-rw-r-- 1 root wheel 16068 Dec 22 18:26 libattach.dylib
-rw-rw-r-- 1 root wheel 552948 Dec 22 18:26 libawt.dylib
-rwxrwxr-x 1 root wheel 721004 Dec 22 18:26 libawt_lwawt.dylib
-rwxrwxr-x 1 root wheel 9164 Dec 22 18:26 libbci.dylib
-rw-rw-r-- 1 root wheel 186456 Dec 22 18:26 libdcpr.dylib
-rwxrwxr-x 1 root wheel 62900 Dec 22 16:03 libdecora_sse.dylib
-rw-rw-r-- 1 root wheel 166872 Dec 22 18:28 libdeploy.dylib
-rw-rw-r-- 1 root wheel 25616 Dec 22 18:26 libdt_socket.dylib
-rw-rw-r-- 1 root wheel 419360 Dec 22 18:26 libfontmanager.dylib
-rwxrwxr-x 1 root wheel 174156 Dec 22 16:03 libfxplugins.dylib
-rw-rw-r-- 1 root wheel 380580 Dec 22 16:03 libglass.dylib
-rwxrwxr-x 1 root wheel 1185040 Dec 22 16:03 libglib-lite.dylib
-rw-rw-r-- 1 root wheel 1537888 Dec 22 16:03 libgstreamer-lite.dylib
-rw-rw-r-- 1 root wheel 212872 Dec 22 18:26 libhprof.dylib
-rw-rw-r-- 1 root wheel 142392 Dec 22 18:26 libinstrument.dylib
-rw-rw-r-- 1 root wheel 41124 Dec 22 18:26 libj2gss.dylib
-rw-rw-r-- 1 root wheel 15092 Dec 22 18:26 libj2pcsc.dylib
-rw-rw-r-- 1 root wheel 70692 Dec 22 18:26 libj2pkcs11.dylib
-rw-rw-r-- 1 root wheel 8852 Dec 22 18:26 libjaas_unix.dylib
-rw-rw-r-- 1 root wheel 216684 Dec 22 18:26 libjava.dylib
-rw-rw-r-- 1 root wheel 28896 Dec 22 18:26 libjava_crw_demo.dylib
-rwxrwxr-x 1 root wheel 38524 Dec 22 16:03 libjavafx_font.dylib
-rwxrwxr-x 1 root wheel 776700 Dec 22 16:03 libjavafx_font_t2k.dylib
-rwxrwxr-x 1 root wheel 250956 Dec 22 16:03 libjavafx_iio.dylib
-rw-rw-r-- 1 root wheel 8652 Dec 22 18:26 libjawt.dylib
-rw-rw-r-- 1 root wheel 304248 Dec 22 18:26 libjdwp.dylib
-rw-rw-r-- 1 root wheel 25328 Dec 22 18:26 libjfr.dylib
-rw-rw-r-- 1 root wheel 240840 Dec 22 16:03 libjfxmedia.dylib
-rwxrwxr-x 1 root wheel 214088 Dec 22 16:03 libjfxmedia_avf.dylib
-rwxrwxr-x 1 root wheel 53104 Dec 22 16:03 libjfxmedia_qtkit.dylib
-rw-rw-r-- 1 root wheel 38159152 Dec 22 16:03 libjfxwebkit.dylib
-rw-rw-r-- 1 root wheel 180468 Dec 22 18:26 libjpeg.dylib
-rw-rw-r-- 1 root wheel 14628 Dec 22 18:26 libjsdt.dylib
-rw-rw-r-- 1 root wheel 15744 Dec 22 18:26 libjsig.dylib
-rw-rw-r-- 1 root wheel 74872 Dec 22 18:26 libjsound.dylib
-rw-rw-r-- 1 root wheel 374428 Dec 22 18:26 libkcms.dylib
-rwxrwxr-x 1 root wheel 333072 Dec 22 18:26 liblcms.dylib
-rw-rw-r-- 1 root wheel 53576 Dec 22 18:26 libmanagement.dylib
-rw-rw-r-- 1 root wheel 834796 Dec 22 18:26 libmlib_image.dylib
-rw-rw-r-- 1 root wheel 90964 Dec 22 18:26 libnet.dylib
-rw-rw-r-- 1 root wheel 61444 Dec 22 18:26 libnio.dylib
-rw-rw-r-- 1 root wheel 198936 Dec 22 18:28 libnpjp2.dylib
-rw-rw-r-- 1 root wheel 15684 Dec 22 18:26 libnpt.dylib
-rw-rw-r-- 1 root wheel 55364 Dec 22 18:26 libosx.dylib
-rw-rw-r-- 1 root wheel 110948 Dec 22 18:26 libosxapp.dylib
-rw-rw-r-- 1 root wheel 14424 Dec 22 18:26 libosxkrb5.dylib
-rw-rw-r-- 1 root wheel 36068 Dec 22 18:26 libosxui.dylib
-rwxrwxr-x 1 root wheel 54732 Dec 22 16:03 libprism_common.dylib
-rwxrwxr-x 1 root wheel 62236 Dec 22 16:03 libprism_es2.dylib
-rwxrwxr-x 1 root wheel 67968 Dec 22 16:03 libprism_sw.dylib
-rwxrwxr-x 1 root wheel 10104 Dec 22 18:26 libresource.dylib
-rw-rw-r-- 1 root wheel 77036 Dec 22 18:26 libsaproc.dylib
-rw-rw-r-- 1 root wheel 348848 Dec 22 18:26 libsplashscreen.dylib
-rw-rw-r-- 1 root wheel 161704 Dec 22 18:26 libsunec.dylib
-rw-rw-r-- 1 root wheel 310336 Dec 22 18:26 libt2k.dylib
-rw-rw-r-- 1 root wheel 102100 Dec 22 18:26 libunpack.dylib
-rw-rw-r-- 1 root wheel 49472 Dec 22 18:26 libverify.dylib
-rw-rw-r-- 1 root wheel 36600 Dec 22 18:26 libzip.dylib
-rw-rw-r-- 1 root wheel 2455 Dec 22 18:26 logging.properties
drwxrwxr-x 6 root wheel 204 Feb 1 22:02 management
-rw-rw-r-- 1 root wheel 381 Dec 22 18:26 management-agent.jar
-rw-rw-r-- 1 root wheel 2107 Dec 22 18:26 meta-index
-rw-rw-r-- 1 root wheel 3070 Dec 22 18:26 net.properties
drwxrwxr-x 5 root wheel 170 Feb 1 22:02 nibs
-rw-rw-r-- 1 root wheel 944069 Dec 22 18:28 plugin.jar
-rw-rw-r-- 1 root wheel 2796 Dec 22 18:26 psfont.properties.ja
-rw-rw-r-- 1 root wheel 10393 Dec 22 18:26 psfontj2d.properties
-rw-rw-r-- 1 root wheel 3502025 Dec 22 18:26 resources.jar
-rw-rw-r-- 1 root wheel 66604445 Dec 22 18:26 rt.jar
drwxrwxr-x 11 root wheel 374 Feb 1 22:02 security
drwxrwxr-x 5 root wheel 170 Feb 1 22:02 server
drwxrwxr-x 3 root wheel 102 Feb 1 22:02 shortcuts
-rw-rw-r-- 1 root wheel 1210 Dec 22 18:26 sound.properties
-rw-rw-r-- 1 root wheel 102332 Dec 22 18:26 tzdb.dat
我将文件复制到
IntelliJ/jre
,仍然没有运气。$ ll /Applications/IntelliJ\ IDEA\ 15\ CE.app/Contents/jre/jdk/Contents/MacOS/
total 552
-rw-r--r-- 1 root admin 216684 May 21 18:22 libjava.dylib
-rwxr-xr-x@ 1 root admin 61704 Jan 5 22:29 libjli.dylib
最佳答案
我有完全相同的问题,但是正在启动该应用程序的另一个版本。
当您启动诸如IntelliJ,Eclipse等应用程序时,即使您将它们设置为特定的设置,它们也不会使用环境变量。因此将JAVA_HOME
设置为一个特定版本完全没有帮助。
您需要检查MacOS上Java的默认版本是什么。
您可以使用以下方法进行检查:
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (5):
11.0.1, x86_64: "... 11.0.1" /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
9.0.4, x86_64: "Java SE 9.0.4" /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
1.8.0_162, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home
1.8.0_152, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home
1.8.0_144, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
最后一行指向Java的默认版本。
所以对我来说,这指向的是JDK 11。
从Jdk9开始,
libjava.dylib
的位置在/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/libjava.dylib
下。而且对于JDK-12,这似乎是broken
由于这不适用于Java的默认版本,因此我禁用了JDK 9和11,因此默认版本为JDK8。
这可以通过将
Info.plist
重命名为Info.plist.disabled
目录中的<jdk_version>/Contents
来完成。sudo mv /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Info.plist /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Info.plist.disabled
sudo mv /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Info.plist /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Info.plist.disabled
再次运行
/usr/libexec/java_home -V
,现在指向jdk1.8.0_162
。该应用程序现在可以正常启动。