Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij 15 Error: could not find libjava.dylib

I installed Intellj 15 in my macos. While running it throws following error.

$ /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

I have JAVA_HOME set as

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

I have libjava.dylib in /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/.

Also, I have libjava.dylib in /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

I copied the file to IntelliJ/jre, still no luck.

$ 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
like image 743
prayagupa Avatar asked May 21 '16 22:05

prayagupa


1 Answers

I'd the exact same issue but with another version of the application being launched.

When you launch applications such as IntelliJ, Eclipse, etc, they wont use the environment variables even though you set them to something specific. so setting JAVA_HOME to one particular version doesn't help at all.

You need to check what is the default version of Java on MacOS.

You can check that using the following:

$ /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

The last line points to the default version of Java. So for me, this was pointing to JDK 11. Starting from Jdk9 onwards, the location of libjava.dylib is under /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/libjava.dylib.

Also this seems to be broken for JDK-12

Since this was not working for the default version of Java, I disabled both JDK 9 and 11 so that the default version is JDK8.

This can be done by renaming the Info.plist to Info.plist.disabled in <jdk_version>/Contents directory.

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

Ran /usr/libexec/java_home -V again which now points to jdk1.8.0_162. The Application is now launching fine.

like image 180
Neo Avatar answered Nov 10 '22 18:11

Neo