Friday, May 1, 2009

This may help to troubleshoot Eclipse

When Eclipse came out to public as free, I was using various other IDE's to make programs. Most of them was not free, so I could not use them as I wanted, unless it is provided to me. Naturally, I fell in love with Eclipse when I first saw it, althgouth it was not as fancy as commercial IDE's.

Eclipse now-a-days is a lot stronger, faster, and flexible than before. But sometimes it does not work as it supposed to be, as least to the users, especially if you've never encountered the problem before.

1. Eclipse does not start.
It happens time to time, when you install a newer version of a new installation of Eclipse for some reasons. (I'll grab some image or copy of error message, if I make one)

The first thing to check is, whether you are using the correct version of Java? It may be easy, since Eclipse will tell why it is not working. But if you're working with lots of plug-ins and updated regularly, you may not notice what's happening inside Eclipse. For example, under Eclipse 3.4, some plug-ins, for example latest version of CDE, require Java 6 to work properly, instead of Java 5 which is required in Eclipse 3.4. But Eclipse does not say much about that on screen. Checking Java version is first thing to do.

The next thing to check is multiple Java Runtime. If Eclipse does not start, even if you checked and confirmed correct version of Java is installed on system, you may have multiple version of Java Runtime. I saw this case in Microsoft Windows environment from time to time. It is possible that you installed Java Runtime by the request of web site to run some applets or programs in the past and forgot about that. In that cases, Eclipse does not run no matter how many times you remove and install new version of Eclipse. The simple remedy is to add following line in eclipse.ini file which exist right under ./eclipse directory. (Or you may just remove unnecessary Java Runtime.)
vm
C:\Sun\SDK\jdk\bin\javaw.exe

This is just an example, and the path of "javaw.exe" is depend on where you've installed your Java. if you're using Linux, it will be like
vm
/usr/share/java/jdk1.6/bin/java

You have to remember that path must be placed in the right next line. And don't put it between the pair of arguments. So it may be better to place it at the end of file.

2. SVN is not working.
This is another disturbing and time consuming case, if you are not familiar with error. This happens mostly in Linux environment, and the main cause is JavaHL native library. Typical error message is “Unable to load default SVN client,” if you're using Subclipse. If you're using only remote repositories and you have more than on client installed, the solution is simple.

Change the default SVN client.

You can change SVN client by changing Client field, under the menu of “\Window\Preferences” and under \Team\SVN category. Or if you're using "Subversive," you can change SVN connector under "SVN connector" tab. All you have to do is select other SVN client than “JavaHL(JNI),” such as SVNkit.

But if you're using local repositories and want faster access, you may have no other choice but to use "JavaHL". The procedure is as follow.

First, you need to install libsvnjavahl library, because "Subclipse" or "Subversive" does not comes with it. You can search the package name like libsvn-java using
sudo apt-cache search libsvn

Then install package using
sudo apt-get install libsvn-java

then, you may have to check the version of libsvn you've installed, in case you do not remember. Type
sudo apt-cache showpkg libsvn-java

If you have a package manager like “Synaptic Package Manager,” you may install and check the version inside package manager.

Current version of Ubuntu comes with 1.5.4 version of libsvn-java. Thus you can only install 1.4.x version of subclipse for Eclipse 3.2, 3, or 4. If you want 1.6.x version of subclipse, you need higher than 1.5.x version of libsvn libaray.

Next step is as before, modify eclipse.ini. This time you need to pass an argument to Java VM by adding following line

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

and this should be placed below “-vmargs” So, the tuple will be like

-vmargs
-Dosgi.requiredJavaVersion=1.5
-Djava.library.path=/usr/lib/jni

Then, you can check the client in the preference, under the menu of “\Window\Preferences” and under \Team\SVN category. If it is working, "JavaHL" and version number will be displayed in client combo box, if not, it will say “JavaHL(JNI) Not Available.”

If that happens your Eclipse is not loading eclipse.ini file you modified when it boot up. And example of this case is when you've registered Eclipse in the menu with different working directory. Then all you have to do is find the correct place to put eclipse.ini.

No comments:

Post a Comment