Docear on macOS: Navigating the Apple Java Nightmare

So this blog post will be brief, as I suppress my disdain for Apple’s attitude towards Java, now that they no longer need it to survive due to their App Store ecosystem.

This blog post documents how I was able to get the Docear Mindmapping software working on OSX El Capitan (10.11).

Sadly, many Java applications which should ‘run anywhere’ simply don’t anymore on the Mac.  Apple abandoned their own internal version of the JRE and bundling with the OS, and deferred said support to the author of Java, now Oracle.  Oracle, too have contributed to the nightmare in providing little assistance in making the transition seamless.

After installing Docear on my mac, I attempted to start it with the icon in the Applications folder in the usual way only to find it bounce in the dock once, and disappear.  How rude I thought.  So I resorted to the command line (gotta love UNIX-like desktops).  When I attempted to start it there, I was presented with the ugly error message:

$ /Applications/Docear.app/Contents/MacOS/FreeplaneJavaApplicationStub
JavaVM: Failed to load JVM: /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bundle/Libraries/libserver.dylib
JavaVM: Failed to load JVM: /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
[JavaAppLauncher Error] JNI_CreateJavaVM() failed, error: -1

Just lovely.  I actually thought I was running Java JRE 1.8 that I downloaded from Oracle.  Seems there are other versions lurking on my system.

I’ll spare you all the drudgery of diagnosing this issue and coming up with a solution.  I will tip my hat to Oliver Dowling and his blog post which eventually lead me to the solution below.  One thing I did learn is that creating a symbolic link for libserver.dylib did not work for me.  I had to instead create a hard link.  I suspect the JRE stub FreeplanJavaApplicationStubJavaVM binary was checking for the existence of a ‘normal’ file rather than ‘a’ file.

Anyway, here are the goods to make Docear work on OSX10.11 (and hopefully other versions).  Be sure to substitute the Java version numbers in the file paths with your version of Java installed.

$ cd /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home
$ sudo ln -s jre/lib bundle
$ cd bundle
$ sudo mkdir Libraries
$ sudo ln /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/server/libjvm.dylib libserver.dylib

Hopefully after executing these commands, you will be able to use Docear.  Good luck!