Eclipse and subversion: Failed to Load JavaHL Library

I haven’t used eclipse for some time (I recently spent more time upgrading, securing servers and writing shell scripts than actually programming). Now I wanted to check what the status of one of my latest projects was. But when I started Eclipse and synchronized with the subversion repository, I got the following error message:

Failed to load JavaHL Library.
These are the errors that were encountered:
no libsvnjavahl-1 in java.library.path
no svnjavahl-1 in java.library.path
no svnjavahl in java.library.path
java.library.path = .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

I then searched for this library in the library path (was not sure it was really missing there), and found something:

$ ls -l /Library/Java/Extensions/libsvnjavahl-1.*
lrwxr-xr-x  1 root  admin  35 Mar 22  2013 /Library/Java/Extensions/libsvnjavahl-1.dylib -> /usr/local/lib/libsvnjavahl-1.dylib

I somehow remembered there were two files last time I had issues with the subversion integration. So I followed the linked and checked what was in /usr/local/lib:

$ ls -l /usr/local/lib/libsvnjavahl-1.*
lrwxr-xr-x  1 henribenoit  admin  53 Jul 24 23:35 /usr/local/lib/libsvnjavahl-1.0.dylib -> ../Cellar/subversion/1.7.8/lib/libsvnjavahl-1.0.dylib
lrwxr-xr-x  1 henribenoit  admin  47 Jul 24 23:35 /usr/local/lib/libsvnjavahl-1.a -> ../Cellar/subversion/1.7.8/lib/libsvnjavahl-1.a
lrwxr-xr-x  1 henribenoit  admin  51 Jul 24 23:35 /usr/local/lib/libsvnjavahl-1.dylib -> ../Cellar/subversion/1.7.8/lib/libsvnjavahl-1.dylib
lrwxr-xr-x  1 henribenoit  admin  52 Jul 24 23:35 /usr/local/lib/libsvnjavahl-1.jnilib -> ../Cellar/subversion/1.7.8/lib/libsvnjavahl-1.jnilib

So I have a link to the .dylib file in /Library/Java/Extensions/ but I miss a link to the .jnilib. Easy to fix:

$ ln -s /usr/local/lib/libsvnjavahl-1.jnilib /Library/Java/Extensions/libsvnjavahl-1.jnilib

After that I could syncronize with the svn repository in Eclipse !

Another solution I tried is to move away from the jni based svn client adapter and use the pure Java SVNKit adapter. To change this setting, go to the Eclipse preferences and write svn in the filter:

SVN interface client

I’ve resized the window to only show the relevant setting, this dialog actually has many more settings. In the displayed select box you can choose between JavaHL (JNI) and SVNKit (Pure Java). If you use SVNKit, you don’t need to have access to the native library shown above.

When it comes to choosing between JavaHL and SVNKit: When a new version of subversion is available, JavaHL is usually available earlier. So you can upgrade earlier. But it is often more difficult to install and integrate than SVNKit.

2 thoughts on “Eclipse and subversion: Failed to Load JavaHL Library

Leave a Reply

Your email address will not be published. Required fields are marked *