ENUMs, User Preferences, and the MySQL SET Datatype
Enforce Coding Standards with PHP_CodeSniffer and Eclipse IDE on Ubuntu Linux
A Simple ISAPI Filter for Authentication on IIS
Using PHP pspell Spell Check Functions with a Custom Dictionary
Getting Set up with Ogre 3D on Ubuntu
Installing Xdebug for use with Eclipse or Netbeans on Linux

Using the JavaHL Native SVN Library in Eclipse

Wednesday, 28 April 10, 11:26 pm
With later versions of Eclipse and/or the SVN plugin, you have the option of using the Java native interface (JNI) library for Subversion support. For performance and platform independence, Subversion is written in C. The JavaHL library is written by the Subversion team, and basically provides Java wrappers for Subversion's C API. You can use SVNkit, which is a pure Java Subversion library, but until you've sorted it out one way or the other, you're likely to see lots of error messages reading "Failed to load JavaHL Library".

In Eclipse, go to Window > Preferences, and expand Team in the left-hand pane and click on SVN. Towards the bottom of the options on the right-hand side, you'll see a drop-down labelled SVN Interface. By default this is set to JavaHL but this option requires the JavaHL SVN libraries to be installed by following the steps below. If you can't be bothered installing the extra stuff, you can simply set this dropdown to SVNkit (Pure Java).

However, if you wish to install JavaHL because it's cool and offers more direct access to SVN functionality, on a Debian-based distro such as Ubuntu you can get the required library via apt:
sudo apt-get install libsvn-java
By default, the necessary goods will be installed at /usr/lib/jni, and you now need to tell Java where to find them whenever Eclipse starts up. There are actually at least three ways to do this.

The best way is to change your eclipse.ini settings file located in your Eclipse root folder. This file seems to list all the start up options that should be used when starting Eclipse. We need to add the following line at the end of this file:
As a command line option when starting Eclipse:
eclipse -vmargs -Djava.library.path=/usr/lib/jni
Note the use of the -vmargs option. This is a special Eclipse option which should precede any options that are to be passed directly to the Java Virtual Machine (VM).

The other way is to add the JNI path to the LD_LIBRARY_PATH environment variable before starting Eclipse. You can create a shell script to do this for you if you wish:
#! /bin/sh export LD_LIBRARY_PATH=/usr/lib/jni ~/eclipse/eclipse

Make subclipse Ignore Specific Paths and Files

The subclipse plugin has a neat feature where it will automatically add to subversion any new files within a folder when you do a commit on that folder. (This compares with the command line usage, where you must first do an svn add on any new files before they will be included in commits.) The drawback is that it will try to add files that should never be added to the repository. For instance, if you try to commit a whole project, subclipse will detect that Eclipse settings folders and files are not in the repository, and would add them unless you uncheck them all first.

To get it to ignore files like this, we could set svn propset svn:ignore on all the Eclipse settings files each time we create a project, but this would be a pain in the arse so instead we can use a setting in Eclipse. In the Preferences dialog found in the Window menu, expand the Team settings and select Ignored Resources. This is where we can define files and folders that should be ignored by subclipse (and CVS should you use that). Add the following patterns to skip Eclipse settings files and folders: .buildpath, .project, and .settings.

Another Weird Thing Subclipse Does

Subclipse seems to use the most recently used credentials when checking out a new repository. If you only checkout subversion projects using the same user name, this shouldn't be an issue. If you checkout a project using a name other than your usual one (even if you check it out outside of Eclipse), subclipse will try to use that user name for future checkouts. To get round this, go to where SVN stores user credentials and delete the most recent file. On Linux, this is at ~/.subversion/auth/svn.simple. Windows losers - sorry, I mean Windows users - will find it at \Documents and Settings\your_username\Application Data\Subversion\auth\svn.simple. Note that this assumes you're using the simple aka unsafe plaintext credential storage.


10:21 pm, Wednesday, 9 November 11

* Move eclipse.ini into /etc (LP: #43162)
-- Debian Orbital Alignment Team Thu, 18 Mar 2010 12:13:51 +0100
Leave Comment

/xkcd/ Wifi vs Cellular

About This Page