Month: March 2012

JavaHL Issues with Eclipse Plugin


Issue with JavaHL library when using Eclipse

While using the subversion plugin ‘sublipse’ in Eclipse IDE, i ran into the following problem

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 = /usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/i386/client::/
usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/i386::/usr/lib/firefox:/usr/lib/
firefox/:/usr/java/packages/lib/i386:/lib:/usr/lib

This is because the JavaHL library used by the SVN plugin in Eclipse to interface with SVN Server is missing or not available. There are two ways to rectify this.

  1. Install the JavaHL library and point eclipse to this.
  2. Use ‘PureSVNKit’ in SVN Preferenves in Eclipse ( Window -> Preferences -> Team -> ‘SVN Preferences’ )

I went for the first one. Here is how you do it

1. Install libsvn. In ubuntu, use the following command

sudo  apt-get install libsvn-java

2. This will install the file libsvnjavahl-1.so into the /usr/lib/jni directory. Standard installations of eclipse will automaticall pick it up. ( Only a restart of eclipse is necessary )

3. For non standard installations of eclipse, you wil need to edit the ‘eclipse.ini’ file in the eclipse home directory. To the ‘vmargs’ section of the file, add the following detail

-Djava.library.path=/usr/lib/jni

Find below, the contents of my eclipse.ini

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
–launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-product
org.eclipse.epp.package.java.product
-showsplash
org.eclipse.platform
–launcher.XXMaxPermSize
1024m
-vm
/home/mindtree/java/jdk1.6.0_22/jre/bin
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Djava.library.path=/usr/lib/jni
-XX:MaxPermSize=1024m
-Xms40m
-Xmx512m
-vm
/home/mindtree/java/jdk1.6.0_22/jre/bin

What you are doing here is , we are passing the library location to the VM whcih runs Eclipse. So eclipse will look for ‘library files’ in this location as well.

For more on JavaHL, use the JavaHL FAQ @ http://subclipse.tigris.org/wiki/JavaHL