Version Info:
Ubuntu Linux 10.04
What: Installing Subclipse on Eclipse Helios
How it all started:
I installed Subclipse using the Eclipse update site but I got the following message on attempting to connect to an SVN rep.
"Unable to load default SVN client"
Background:
Version compatibility between Subclipse and JavaHL:
Subclipse Version SVN/JavaHL Version
1.6.x 1.6.x
1.4.x 1.5.x
1.2.x 1.4.x
1.0.x 1.4.x
In my case I installed Subclipse 1.6.x using the following Eclipse update site.
http://subclipse.tigris.org/update_1.6.x
There are two competing approaches to getting subclipse to talk to Subversion
i) JavaHL
ii) SVNKit
Why do I need JavaHL?
Subversion is written in C and it provides language bindings for Java among several other languages.
JavaHL is a "High Level" API and is provided with custom written C++ code to serve as the JNI bridge between Java code and the native libraries.
Subclipse is written in Java, so it needs to use the JavaHL library to be able to use the Subversion API. Subclipse includes the Java layer of JavaHL.
Problems encountered:
a) Subversion Native library not available
Subclipse talks to Subversion via a Java API that requires access to native libraries.Those libraries were either not found or an incompatible version was loaded.
Steps:
a) Install the JavaHL library
It is in the 'libsvn-java' package.
Now that we know what package it is in, install it using one of the following approaches
- apt-get install libsvn-java (Do we need to 'sudo' for this?)
- Use the Synaptics Package manager
- Use the Ubuntu Software Center
b) Once you have the library installed, you still have to tell Java (when used for Eclipse) where to find the library.
The easiest way to tell Java where to find the JavaHL library is to specify the following when starting the JVM:
-Djava.library.path=/usr/lib/jni
The name of the library is libsvnjavahl-1.so. The path you specify should contain this file.
Eclipse provides its own mechanism for providing this setting. Eclipse comes with a file named eclipse.ini. (If you do not know where your eclipse.ini is, open a Terminal and search for it using locate eclipse.ini )
This file is looked at when the Eclipse launcher starts the JVM and appends settings to the VM when launching it. Specifically, you should see a line that says "-vmargs". Add a newline after this line and insert the above line to pass the setting the JVM needs. Each argument needs to be on its own line, so be sure to add a new line and then put the entire string above on its own line.
Sources:
http://subclipse.tigris.org/wiki/JavaHL
http://stackoverflow.com/questions/553133/subclipse-with-svnkit-adapter