3

Platform: MAC Catalina 10.15.3 (64 bit) Eclipse: eclipse-java-2020-03-R-macosx-cocoa-x86_64.dmg (64 bit)

This was as a result of attempting to fix and issue where the eclipse JRE was The container 'JRE System Library [...]' references non existing library '...' and the subsequent fix. After these modifications were made I shut down eclipse and on restarting it I encountered this error. Importantly, doing echo $JAVA_HOME provides nothing in return. The below journals the other attempts to get Eclipse up and running.

After uninstalling and reinstalling both eclipse and java I still get the error "Failed to create the Java Virtual Machine".

On running ./eclipse from the command line I get:

Error: could not find libjava.dylib
Failed to GetJREPath()

On running ./eclipse -vm /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/lib from the command line I get:

cmacedo@Christians-MBP eclipse % ./eclipse -vm /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/lib
Error: could not find libjava.dylib
Failed to GetJREPath()

On checking the folder /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/lib I see it does indeed contain libjava.dylib

And, if I attempt to do the below, I get a permissions denied:

cmacedo@Christians-MBP ~ % echo "export JAVA_HOME=`/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/`" >> ~/.profile
zsh: permission denied: /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/
TheMightyLlama
  • 1,243
  • 1
  • 19
  • 51
  • .../Contents/Home is the usual location to specify (no lib at the end) – greg-449 Mar 19 '20 at 16:25
  • @greg-449 that starts it up from the command line. And idea what I need to modify so eclipse uses this each time? – TheMightyLlama Mar 19 '20 at 16:33
  • It may help if you [edit] your question and add a couple of [probably unimportant] details. Namely what Eclipse version are you using and what platform are you on, e.g. Windows or linux or Mac. Also is that 32-bit or 64-bit platform? – Abra Mar 19 '20 at 16:41
  • Doing a quick test here I get this error using the latest Eclipse 2020-03 (but without the Java 14 patch). Not sure if the patch helps. – greg-449 Mar 19 '20 at 16:50
  • @greg-449 Which of the three are you getting? – TheMightyLlama Mar 19 '20 at 16:52
  • Failed to create java virtual machine just by updating to Java 14 and starting my normal Eclipse. I have reverted back to Java 13.0.2. This should be reported on Eclipse bugzilla https://bugs.eclipse.org/bugs/ – greg-449 Mar 19 '20 at 16:54
  • I still have the same problem on version 8. and echo $JAVA_HOME is still empty. – TheMightyLlama Mar 19 '20 at 17:07
  • You echo has the wrong quotes - back tick tries to execute code - it should be single quote. – greg-449 Mar 19 '20 at 18:03
  • I'd suggest avoiding JDK 14 as a runtime for Eclipse for now. Use 8 or 11. – nitind Mar 19 '20 at 19:45
  • See [this answer](https://stackoverflow.com/a/60771575/2670892) for more details – greg-449 Mar 20 '20 at 09:34
  • See https://stackoverflow.com/a/60970143/231397 – Christian Fries Apr 01 '20 at 13:10

2 Answers2

4

TL;DR

If you can still reproduce the issue, execute:

cd /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/MacOS
sudo ln -fs ../Home/lib/libjli.dylib

More details

You had recent version of Oracle JDK 14. There is known bug with recent version of Oracle JDK or Open JDK: JDK-8238225. The issue has been reported also in Eclipse: eclipse bug 559482.

The issue will be fixed by next releases of JDK.

Meanwhile, the workaround differs depending of JDK version. I have done some experimentations to find generic solution. This one should always work:

cd $($(dirname $(readlink $(which javac)))/java_home)/../MacOS
sudo cp libjli.dylib libjli.dylib.bak
sudo ln -fs $(find ../Home -name libjli.dylib)
Jean-Pierre Matsumoto
  • 1,917
  • 1
  • 18
  • 26
-3

Although not a solution to the problem. I ended up doing a factory reset. I know this won't help many people. However, it worked...

TheMightyLlama
  • 1,243
  • 1
  • 19
  • 51