Installing JavaHL for Subclipse/Eclipse on Ubuntu

While installing the subversion plugin Subclipse in the Eclipse IDE I came across a problem. Subclipse uses "JavaHL (JNI)" to interface with subversion by default. This default setting generates an error when accessing the "Window->Preferences->Team->SVN" preferences:

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

NOTE: I am using Sun Java

This error does not seem to affect the basic subversion functionality (eg, checkout, commit, merge, etc.) and only appears when accessing the SVN preferences. However I have a custom subversion config I like to use in PHP development and I need to be able to access the SVN preferences.

The simplest way to bypass this issue is to select the "SVNKit (Pure Java)" in the "SVN interface" section of the SVN preferences. However if you require and/or desire the JavaHL subversion interface read on for a fix.

Install libsvn-java

The Debian/Ubuntu package libsvn-java has the libsvnjavahl-1.so file that is required by JavaHL subversion interface. Install libsvn-java by typing the following into a command line:

sudo  apt-get install libsvn-java

Restart Eclipse.

After installation is complete the required file (libsvnjavahl-1.so) is installed into the /usr/lib/jni directory. Default installations of Eclipse will pick this directory up automatically. Non-standard installation, such as ones installed by hand, will not find the required file.

Non-standard Installations

I need to tell Eclipse where to find libsvnjavahl-1.so for non-standard installations. The error message indicates the required file cannot be found in the paths defined by java.library.path. We can either place the file (via symlink) into one of the specified paths OR set the java.library.path to point to the /usr/lib/jni directory. Using a symlink is viable however future upgrades of java may cause the installation to break. As illustrated below I have chosen to overwrite the java.library.path variable.

Set java.library.path via eclipserc

This solution affects the Eclipse installation on a per-user basis. Changes made here will not effect anyone else using Eclipse. To over-ride the java.library.path variable we will need to create a file called eclipserc in the .eclipse directory:

gedit ~/.eclipse/eclipserc

NOTE: The ~/.eclipse directory is created when Eclipse is first run.

Add the following line to ~/.eclipse/eclipserc:

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

Save the file and close it. Restart Eclipse and JavaHL will no longer generate error messages when accessing the SVN preferences.

Leads and Resources

  

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

tnks

For ubuntu 11.04 and eclipse 3.6 work to

Thanks a lot, it helped me.

Thanks a lot, it helped me. although i change the file in eclipse.ini.

...
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-Djava.library.path=/usr/lib/jni

helpful... yet my search continues

thanks for the tutorial; it has helped me understand just what exactly is going on.
I have the current java libraries, but subeclipse still couldn't find the default svn client. (Maverick with Eclipse 3.5.2)

I opted for Chepech's solution in using SVNKit.

I'm still scratching my head due to new errors.

Working!! Thanks

Ubuntu 10.04, eclipse Helios R2.

Thanks a lot!!

Cheers

Thx

Thanks it worked for me as well.

Thanks

Thanks, the Ubuntu 10.04 LTS / Helios / eclipse.ini tip worked.

Thank you very much man!

Thank you very much man!

a solution worked with me (Ubuntu 10.04)

 Step 1:  Install this

apt-get install libsvn-java

Step 2: Close your Eclipse if it's running before making changes.Open file  eclipse.ini (in folder Eclipse)Before  :-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m After modify-vmargs
-Djava.library.path=/usr/lib/jni
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx512mHope it works for u : )

Subclipse for Joomla! Dev.

Thank you, for helping me find an an easy quick fix!

You Rock!

Thanks this solved my headache!

Had to modify eclipse.ini in

Had to modify eclipse.ini in the eclipse install directory for Eclipse 3.6 Helios on Ubuntu 10.04. I just added this as the last line: -Djava.library.path=/usr/lib/jni

Thank you very much :)

Thank you very much :)

Thanks, so easy!

Thanks, so easy!

Thanks, it worked!

Thanks, it worked!

Worked perfectly

Thanks a lot, it worked

Excellent

Thanks, it work perfectly. You truly made my day..!

Thanks a lot

thanks a lot for the suggestion... it worked :)

Very good tutorial

Thanks !!

Using Pure Java interface

If you are having troubles with the JavaHL there is a way not to use it. You just need to install the SVNKit from the same update site as Subeclipse. that enables the option to use Pure JAVA Interface under Window>Preferences>Team>SVN > SVN Interface, just change it to that, its slower but it works.

Not Working for me...

Im using Ubuntu 9.10 and Eclipse 3.3 Europa (I need europa since its the only compatible with flexbuilder). I tried this but apparently the eclipse.ini is not being loaded when eclipse initializes. I already checked and this is the only eclipse.ini file in the entire disk.

this is my ini file:

-showsplash
org.eclipse.platform
-vmargs
-Djava.library.path=/usr/lib/jni
-Xms512m
-Xmx1024m

The Libraries are indeed in /usr/lib/jni but still getting the error.
I installed the FlexBuilder plugin to that eclipse, maybe that's causing some issue.

Any ideas??

-Djava.library.path=/usr/lib/jni Fixed My Problems

I'm on Ubuntu Squeeze development version and was having trouble but adding -Djava.library.path=/usr/lib/jni to eclipse.ini as indicated in the previous comment fixed my primary problems. Before adding it I had JavaHL in my list of SVN Connectors but it would be automatically deselected upon restart and I'd receive errors attempting any subversion operation. After adding it I got more descriptive text in the SVN Connector list and my selection was persisted. Things are somewhat working although I'm still treading very lightly.

Just a note, the JavaHL package is named libsvn-java in the Squeeze repository.

Re: Not Working for me...

An alternative is to pass the parameters when you run Eclipse.

For instance I have a bash script called runEclipse.sh as follows:

#!/bin/bash

/usr/local/bin/eclipse -vmargs -Djava.library.path=/usr/lib/jni -Xms256m -Xmx512m -Xss2m -XX:MaxPermSize=128m &

If you are running Windows you can update the shortcut and add the parameters.

Worked for me

Using kubuntu, eclipserc did not help. Dvogels advice (tuning command line args) did the trick.

Post new comment

The content of this field is kept private and will not be shown publicly.
By submitting this form, you accept the Mollom privacy policy.