eclipse to use Sun's jvm on Ubuntu
August 24th, 2007
Does your eclipse IDE runs terribly slow on your Ubuntu box? Probably that's because it runs using gcj, a GNU java implementation. In order to improve your eclipse's performance you have to run it using Sun's java.
To see whether you are running your eclipse on gcj or not, go to your eclipse IDE and from the menu go to Help → About Eclipse SDK → Configuration Details. Then search the virtual machine in use, it is the program right after the -vm argument:
If your virtual machine is /usr/lib/jvm/java-gcj/bin/java, like in the example above, then you most likely have found the source of your eclipse's slow performance. Close the Eclipse IDE for now.
Right after, you have find out what Sun java runtime environments are installed in your system. Try out this command:
If you are able to see a directory that matches the java-*-sun pattern, then you have a Sun JVM installed. Otherwise you will have to install one. To install Sun's JVM run the following command:
When your new JVM is installed, you have to configure eclipse to use this one instead. Run this command:
Edit the file and make sure to insert the installation directory of your new JVM on the top, like this:
Save the file and run Eclipse again. It should be using Sun's JVM by now. However, to make sure everything was done right go once more to Help → About Eclipse SDK → Configuration Details and check out if the virtual machine setting is now correct. Performance should be improved by now.
To see whether you are running your eclipse on gcj or not, go to your eclipse IDE and from the menu go to Help → About Eclipse SDK → Configuration Details. Then search the virtual machine in use, it is the program right after the -vm argument:
*** System properties:
eclipse.buildId=M20070212-1330
eclipse.commands=-os inux
-ws tk
-arch 86
-launcher usr/lib/eclipse/eclipse
-name clipse
-showsplash 00
-exitdata 3800c
-install usr/lib/eclipse
-vm /usr/lib/jvm/java-gcj/bin/java
eclipse.ee.install.verify=false
eclipse.product=org.eclipse.sdk.ide
eclipse.startTime=1187974381902If your virtual machine is /usr/lib/jvm/java-gcj/bin/java, like in the example above, then you most likely have found the source of your eclipse's slow performance. Close the Eclipse IDE for now.
Right after, you have find out what Sun java runtime environments are installed in your system. Try out this command:
giannis@giannis-desktop:~$ ls -1 /usr/lib/jvm
java-1.4.2-gcj-4.1-1.4.2.0
java-6-sun
java-6-sun-1.6.0.00
java-gcjIf you are able to see a directory that matches the java-*-sun pattern, then you have a Sun JVM installed. Otherwise you will have to install one. To install Sun's JVM run the following command:
$ sudo apt-get install sun-java6-jdkWhen your new JVM is installed, you have to configure eclipse to use this one instead. Run this command:
$ sudo gedit /etc/eclipse/java_home Edit the file and make sure to insert the installation directory of your new JVM on the top, like this:
# This file determines the search order the Eclipse Platform uses to find a
# compatible JAVA_HOME. This setting may be overridden on a per-user basis by
# altering the JAVA_HOME setting in ~/.eclipse/eclipserc.
/usr/lib/jvm/java-6-sun
/usr/lib/jvm/java-gcj
/usr/lib/kaffe/pthreads
/usr/lib/jvm/java-1.5.0-sun
/usr/lib/j2se/1.5
/usr/lib/j2se/1.4
/usr/lib/j2sdk1.5-ibm
/usr/lib/j2sdk1.4-ibm
/usr/lib/j2sdk1.5-sun
/usr/lib/j2sdk1.4-sunSave the file and run Eclipse again. It should be using Sun's JVM by now. However, to make sure everything was done right go once more to Help → About Eclipse SDK → Configuration Details and check out if the virtual machine setting is now correct. Performance should be improved by now.