“Failed to load JavaHL Library”!-A Disastrous Error

One may get the following error message while installing Subclipse plugin in Eclipse on Mac OS X.

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
/opt/local/lib/libsvnjavahl-1.0.0.0.dylib:  no suitable image found.
Did find:  /opt/local/lib/libsvnjavahl-1.0.0.0.dylib: mach-o, but wrong architecture
This error usually occurs when you are trying to install the subclipse on the 64-bit machine.(This error doesn’t occur if you are using 32-bit machine).
The above error flashes on your screen due to the following reason:
This is because the 64-bit JVM cannot load a 32-bit native library. The CollabNet binaries for OSX do    not have this problem because they include both 32-bit and 64-bit versions.
Solution: Goto this link and download the correct Universal Subversion Binaries file.
For instance if you are using Snow Leopard,then you might probably download the file with “Universal Subversion 1.6.17 Binaries for Snow Leopard (Mac OS X 10.6)” as header.
Unfortunately to download these binaries,you need to register with the CollabNet which is rather painful.This binary package installs the JavaHL.
After downloading the package install it by double clicking the .pkg file.As usual,the installation steps are uncomplicated.
This file creates a folder with “subversion” as name in the “opt” folder. Usually the path would be /MacintoshHD/opt/subversion.
Next step is to update your ./bash_profile file with the following line:
   export PATH=/opt/subversion/bin:$PATH
After you have updated the file close the terminal and then open a new one again.Make sure that you are using the latest version of the Subversion.
You can check this by executing the following line in the terminal:
 svn –version
This should show you something like this :
Image
To test the JavaHL library you can download the javahltests.jar from subclipse.tigris.org
Now Restart your Eclipse and you are done.No more warnings.You can verify that you have got the right version of JavaHL installed  by going to Eclipse->Preferences->Team->SVN.
Under the Svn Interface you will see the version of your JavaHL installed.
Sometimes in the worst situations ,even though you have installed the binaries and Subclipse plugin properly, the Eclipse may give error when you go onto Eclipse->Preferences->Team->SVN as following:
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
Native Library /opt/subversion/lib/libsvnjavahl-1.0.dylib already loaded in the other classloader
/opt/local/lib/libsvnjavahl-1.0.0.0.dylib:  no suitable image found.
Did find:  /opt/local/lib/libsvnjavahl-1.0.0.0.dylib: mach-o, but wrong architecture
If you observe carefully , you would find a new line which is added up to the error message which is
Native Library /opt/subversion/lib/libsvnjavahl-1.0.dylib already loaded in the other classloader
Reason:This occurs if you have already installed the other subversion plugins in your eclipse environment which is preventing  the actual subclipse plugin to load the javaHL library as it is getting loaded in the other subversive plugins. At this point if you goto Eclipse->Preferences->Team->SVN you would find “javaHL not connected” under the Svn Interface.
Solution:When you are installing subclipse plugin in your eclipse environment, make sure that there are no pre installed svn plugins in your eclipse.It would be always better to install the subclipse plugin into an empty eclipse environment which makes your work simple.
Now if you check the Eclipse->Preferences->Team->SVN you would find it as following:
Image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s