Intellij 15错误:找不到libjava.dylib

时间:2016-05-21 22:26:46

标签: java intellij-idea

我在我的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

4 个答案:

答案 0 :(得分:0)

$row["role"] == 1位于jre的lib目录中。在我的机器上,它安装到(我已经安装了92):

libjava.dylib

在您的情况下,/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/libjava.dylib中的文件不会有任何区别。 Intellij不作为applet运行 - 该目录仅用于运行Java Applet的浏览器插件。

在任何情况下,您都应该考虑从Oracle下载并重新安装最新版本的JDK。如果您的安装缺少库,则其他内容也可能会混乱。

答案 1 :(得分:0)

我的问题完全相同,但是正在启动该应用程序的另一个版本。

启动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。 该应用程序现在可以正常启动。

答案 2 :(得分:0)

将gradle升级到最新版本并设置JAVA_HOME和ANDROID_HOME对我来说是正确的。

这是我的bash_profile:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

最适合我的版本是6.0.1

答案 3 :(得分:0)

也许您可以杀死intellij进程并重新启动