Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Append to java.library.path for Subclipse and JavaHL(Need to append to Eclipse's java.library.path, not overwrite)
icon5.gif  Append to java.library.path for Subclipse and JavaHL [message #1402380] Thu, 17 July 2014 00:01
Peter Granger is currently offline Peter GrangerFriend
Messages: 3
Registered: February 2010
Junior Member
This now turns out to be unimportant. The short answer, and the easiest way to do things, is to skip JavaHL, and just use SVNKit instead. It only requires one package to be added to Eclipse, and there are no problems with the java.library.path.

I'm having a problem with using Subclipse and JavaHL within Eclipse, due to a missing item in my java.library.path in Eclipse. Although my problem is specific (needing a library for JavaHL), I believe this is a more general problem, in need of a general solution:

(1) How do I append a value to the java.library.path, rather than replacing the entire java.library.path;
(2) And, how can I do this so that it applies to the entire workspace, including plug-ins, not just a single project?

I have seen references to this problem in other posts, but usually people seem to be asking it in regard to adding a library to a single project. The couple of times I've seen people asking about (or suggesting answers for) a workspace-wide fix, those answers haven't been helpful to me. (I have a list below of the resources I've found while researching this problem.)

I'm going to give a LOT of detail here, describing what I've already found, so that hopefully I won't have to clarify later (and also to avoid getting suggestions of things I've already tried). If you have an answer and don't need to read my trial-and-error steps, then feel free to skip them. Thanks for any assistance!

Also, please accept my apologies for having to remove all of the actual links in my message. The forum restricts me from posting links to other sites. If you need to see the other articles I'm referring to, the URL's are given in non-URL text format.

My environment:

  • Ubuntu 12.04 32-bit
  • Eclipse 4.3.2.v20140221-1852 (Kepler Service Pack 2)
  • Subclipse
  • Subversion 1.8.0 (r1490375)

Eclipse, Subversion, and Subclipse should be fully up-to-date. I cannot, at this time, change Ubuntu versions, but that shouldn't be an issue here.

Subclipse needs a Subversion client; the two I have seen mentioned are SVNKit and JavaHL. I have been attempting to use JavaHL, since it is from the same publisher as Subclipse itself. I may be able to switch to SVNKit, but I would prefer to resolve the problem I'm having with JavaHL.

My installation steps for JavaHL:

I used the Linux installation steps at: subclipse: Wiki: JavaHL (Linux section) (

Following those instructions, I installed libsvn-java ("Java bindings for Apache Subversion"). The files installed by this were:

  • /usr/lib/i386-linux-gnu/jni/
  • /usr/lib/i386-linux-gnu/jni/
  • /usr/lib/i386-linux-gnu/jni/
  • /usr/share/java/svn-javahl.jar

There is really only one file under the JNI directory; /usr/lib/i386-linux-gnu/jni/ is the real file, and the other two are just links to it.

Next, the instructions say to find (which we just did), and add that to my eclipse.ini (located at /usr/lib/eclipse.ini), which would in this case be:


(Alternatively, this value can be set directly in the command line used to launch Eclipse.) My eclipse.ini does have some -vmargs arguments (presumably the defaults installed with Eclipse, since I had not edited that file until now), but it did not have anything for the java.library.path, so that would be a completely new value. This actually does work to get the Subclipse plug-in and JavaHL client working; however, the problem with this is that it does not append the new library to the java.library.path, it entirely replaces any other value in the java.library.path (demonstration of that follows shortly).

The problem I encountered:

Without specifying a value for the java.library.path, I opened Eclipse, and went to Window-->Preferences-->Team-->SVN. When I hit SVN, I get an error dialog which says:

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. The errors are displayed below.

Information on getting a proper version installed and visible to Eclipse is available here:

    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-7-oracle/jre/lib/i386/client:/usr/lib/jvm/java-7-oracle/jre/lib/i386::/usr/java/packages/lib/i386:/lib:/usr/lib

I'll refer to this as the "Original Error Message," since it's what I initially saw when attempting to use Subclipse/JavaHL.

This is how I discovered the problem in the first place. Closing that dialog, the Eclipse SVN Preferences dialog does open, but the SVN Interface Client is shown as "JavaHL (JNI) Not Available." So, this tells us that the JavaHL interface client for the Subclipse plug-in is dependent on the path defined in java.library.path, and I will need to add /usr/lib/i386-linux-gnu/jni to that path. However, I have been unable to find anything indicating where or how that path is set, if I have not set it myself.

I did find that if I right-click on any project, and go to Run As-->Run Configurations...-->Environment-->Select..., it shows a value for LD_LIBRARY_PATH, which is only:


That looks like the beginning of my alleged java.library.path, but it doesn't show the second part, /usr/java/packages/lib/i386:/lib:/usr/lib. If I could find out where that is getting set, it might help. However, this appears to be set on a per-project basis, and I do not want to set the value for a single project; I need it to be set for the entire Eclipse workspace so that it is always available to the Subclipse plug-in.

Also, there's no indication of where that LD_LIBRARY_PATH is coming from. If I try to look at it from the Linux command line, it doesn't seem to be set:

ubuntu:~[2013]> echo ${LD_LIBRARY_PATH}
ubuntu:~[2014]> printenv LD_LIBRARY_PATH

Looking at it from the command line, it has no apparent value. Looking at it in the Eclipse environment settings, it has the "short" path. And when the java.library.path is shown to me in an error message, it has the "long" path.

Web search findings:

I searched for "eclipse append to java.library.path" and found these results:

(1) How to set the java.library.path from Eclipse - Stack Overflow (

(2) How to add native library to "java.library.path" with Eclipse launch (instead of overriding it) - Stack Overflow (

(3) How do I add external libraries to java.library.path in Eclipse? - Stack Overflow (

(4) What is java.library.path , How to set in Eclipse IDE (

(5) EclipseZone - Reference Native Libraries in Project ... (

(6) What is java.library.path? (Java in General forum at JavaRanch) (

Article (1) seems to contain the most widely accepted answer; articles (2) and (3) also contain pointers to it. However, it appears to be oriented toward adding libraries to specific projects in Eclipse, not making those libraries available to plug-ins in the workspace.

Article (4) also contains the "per-project" solution, or recommends using the VM arguments approach, so it doesn't seem to provide anything new. Article (5) again recommends setting the native library location for a single project.

The last item, article (6), explains that the java.library.path comes from my LD_LIBRARY_PATH, and that libsvnjavahl-1 will resolve to, so that seems mostly consistent with what I've found so far, but doesn't give me any help in figuring out how it got the current value, or how to append a new entry to the path.

First attempted fix:

As recommended at the Tigris Subclipse wiki (, I added the line:


to the -vmargs section in my eclipse.ini.

I then opened Eclipse, and went to Window-->Preferences-->Team-->SVN. No errors are reported this time, and the SVN Preferences, SVN Interface Client, shows "JavaHL (JNI) 1.8.0 (r1490375)".

This seems good, BUT, I am naturally skeptical. I don't want to replace the old value of the java.library.path, I want to append the new value to it. Completely replacing the java.library.path will likely result in other problems, as the libraries which were listed there previously would no longer be available.

In order to see what value is being used by Eclipse for the java.library.path, the only thing I could come up with was to cause the error again, with a new path, so I changed the line in eclipse.ini to:


This will fail, but when it does, it will show me the value of the java.library.path. Again restart Eclipse and browse to the Team preferences (Window-->Preferences-->Team-->SVN). The error message is very much as before, except it now says:

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/i386-linux-gnu/jni_error

So, we can see that by setting the value in the eclipse.ini, we are replacing, not appending to, the path. The desired outcome is to figure out how to get:

java.library.path = /usr/lib/jvm/java-7-oracle/jre/lib/i386/client:/usr/lib/jvm/java-7-oracle/jre/lib/i386::/usr/java/packages/lib/i386:/lib:/usr/lib:/usr/lib/i386-linux-gnu/jni

Second attempted fix:

Since I can edit the eclipse.ini, and I think I know what the required java.library.path is, I can attempt that directly, adding:


This works. I am able to browse to the SVN Preferences and see "JavaHL (JNI) 1.8.0 (r1490375)" as the SVN Interface Client. BUT, this really is less than ideal; it doesn't seem like I should need to rewrite the entire path that way. Most of it is configured for me automatically, and if that automatic configuration changes, I don't want to have to repeat these steps and figure it out again.

So we'll keep this method in reserve, in case nothing else better is found.

Third attempted fix:

Several of the articles above recommend going into the Build Path Configuration for a specific project; going to the Libraries tab; and editing the Native Library Locations. As mentioned already, I don't want to set this library for use by a single project, I want it to be used by the workspace and the Subclipse plug-in. But it's a widely accepted solution, so I'll give it a try.

I removed my java.library.path setting from the eclipse.ini, to get back to the original state. Then I selected a working project (just a simple "Hello World" type project), right-clicked on the project, and went to Build Path-->Configure Build Path... In the properties dialog, select the Libraries tab, and expand the JRE System Library. Currently, the Native Library Location shows "(none)". Edit that. The Native Library Folder Configuration dialog says:

Enter the location of a folder containing the native libraries used by 'org.eclipse.jdt.launching.JRE_CONTAINER':

I entered the location of the library I want, /usr/lib/i386-linux-gnu/jni, and saved it. It is shown correctly in the Build Path Configuration dialog. As expected, this seems to have no effect. Regardless of which project I am looking at (or if all projects are closed), and even after restarting Eclipse, attempting to browse to my SVN Preferences gets the Original Error Message, verbatim, indicating that there is "no libsvnjavahl-1 in java.library.path," and the required folder is not part of the java.library.path.

So, the project-based solution doesn't help in this case, because it doesn't affect the plug-in, even when I'm working on that project. I removed that path from my Native Library Path, putting it back to the normal (empty) value.

Fourth attempted fix:

In article (2) above, the original question was the same as mine: "how can I add a path entry to the default java.library.path instead of overriding it (which seems to be done with -Djava.library.path)?"

In that case, the original poster later said he had found the solution:


His recommendation is to (apparently) prepend a new library to the existing java.library.path by adding this to his VM arguments:


That's Windows syntax (backslashes in the path, semicolons for separators, using PATH instead of LD_LIBRARY_PATH), and the presence of the variable workspace_loc:project also seems to indicate that this is a project-specific solution. If I translate this to Linux syntax, though, I should be able to append the library I want in this way:


I should be able to do that in either the Eclipse launcher command line, or in the eclipse.ini file. I've tried it both ways, and this also does not work, for several reasons:

  • If I specify the java.library.path VM argument exactly as shown above, I can see that the JavaHL client is available. But that's a "false positive," because...
  • The system variable LD_LIBRARY_PATH in the command line is never expanded, if specified in the eclipse.ini or the launcher. If I append an invalid path, such as /usr/lib/i386-linux-gnu/jni_error, I get this error message when I try to browse to the 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 = ${LD_LIBRARY_PATH}:/usr/lib/i386-linux-gnu/jni_error

  • If I specify the VM args directly on the command line, not in a launcher or in the eclipse.ini:

    ubuntu:~[2029]> /usr/lib/eclipse/eclipse -vmargs -Djava.library.path=${LD_LIBRARY_PATH}:/usr/lib/i386-linux-gnu/jni_error &

    I can see that the system variable LD_LIBRARY_PATH is expanded, but it is actually empty:

    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/i386-linux-gnu/jni_error

That value for java.library.path shows that LD_LIBRARY_PATH resolves to the empty string, and :/usr/lib/i386-linux-gnu/jni_error is appended to it. So, we can't use that approach, because the system variable LD_LIBRARY_PATH has no value (we are appending to a blank), and system variables are not expanded when specified in the launcher or in the eclipse.ini.

Fifth attempted fix:

One of the replies in article (1) above tries to resolve the issue of per-project vs. workspace-wide setting of java.library.path:


In that reply, the poster says to go to Window-->Preferences-->Java-->Installed JREs, and set the "Default VM arguments." I can select my default JRE, click the [Edit..] button, and get a second dialog with a text box for the Default VM arguments. Unfortunately, there's no further detail on what to set them to. I tried a variety of things, such as typing "-Djava.library.path=/usr/lib/i386-linux-gnu/jni" directly into that text box, and using the adjacent [Variables...] button to select system variables.

Nothing I did here seemed to have any effect. Browsing to Window-->Preferences-->Team-->SVN always shows the Original Error Message, verbatim, with no changes to the value of java.library.path caused by what I've set in the Default VM arguments for the JRE.

Sixth attempted fix:

Also in the Window-->Preferences-->Java-->Installed JREs dialog, there is a button to [Add External JARs...] to the JRE system libraries. Two files were installed with libsvn-java:

  • /usr/lib/i386-linux-gnu/jni/
  • /usr/share/java/svn-javahl.jar

Only one of these appears to be a JAR file, the other seems to be a native library of some sort. Looking at the contents of svn-javahl.jar, it contains /org/apache/subversion/javahl and /org/tigris/subversion/javahl, which look like near-duplicates of each other. On the off chance that this would somehow give me what I needed, I added that to the JRE system libraries, and restarted Eclipse.

As expected, this had no effect. The error message is unchanged, still showing the same java.library.path and the absence of libsvnjavahl-1.

Adding to the JRE system libraries (pretending it was a JAR) also did not have any effect (as expected).

Seventh attempted fix:

At this point, I completely punted, and went with a sloppy, inelegant, but pretty much guaranteed to work (for now) stopgap. We've determined that:

  • The library we really want is at /usr/lib/i386-linux-gnu/jni/
  • The JavaHL Subversion client is looking for
  • The path it searches includes /usr/lib/jvm/java-7-oracle/jre/lib/i386/client:/usr/lib/jvm/java-7-oracle/jre/lib/i386

Therefore, I can use a symlink to make the existing path point to the file we need:

ubuntu:~[2037]> sudo ln -s '/usr/lib/i386-linux-gnu/jni/' /usr/lib/jvm/java-7-oracle/jre/lib/i386/

ubuntu:~[2038]> cd /usr/lib/jvm/java-7-oracle/jre/lib/i386/

ubuntu:/usr/lib/jvm/java-7-oracle/jre/lib/i386[2039]> ll libsvn*
lrwxrwxrwx 1 root root 51 Jul 15 19:03 -> /usr/lib/i386-linux-gnu/jni/

It works. It's a sloppy, ugly, brittle-as-anything fix, but it makes things work. It's making it appear as if an unrelated third-party file is in the basic JRE library. But it works.

So, I've found two ugly kludgy fixes that work, and tried a bunch of others that didn't. I can't figure out how the java.library.path gets set, or how to append to it, but I am able to either (a) replace it completely, or (b) make it look as if the needed library is part of the basic configuration.

Any assistance to actually solve this correctly would be greatly appreciated. Thanks.

[Updated on: Thu, 28 August 2014 22:42]

Report message to a moderator

Previous Topic:Ant not running with JDK 1.5
Next Topic:Eclipse does not compile and write error
Goto Forum:

Current Time: Fri Nov 27 08:39:50 GMT 2020

Powered by FUDForum. Page generated in 0.01525 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top