Eclipse

Finally got around to looking at Eclipse as an IDE for Java. I had tried it about a year ago with much aggravation over heap size. Trying it with Ubuntu 7.4 did not work because Eclipse said that the pointer to Java did not have a valid executable. I have been using Sun

Java  version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)

and the SDK at the same level.

With Ubuntu, the trick is to get Eclipse to look at the right version of Java. The key to the trick is update-java-alternatives. For more detail on update-java-alternatives, do the man page (man update-java-alternatives):

myid@mypc:~/Projects/eclipse$ man update-java-alternatives
Reformatting update-java-alternatives(8), please wait...

The basic idea is to first list the java versions available on your system:

update-java-alternatives -l

Then to pick one and bring the Ubuntu world into alignment with the desired Java world. The way to do this is:

update-java-alternatives -v -s your-desired-java

from the list just displayed. Omit the -v if you hate gory details.

It goes something like this:

my-id@my-pc:~/Projects/eclipse$ update-java-alternatives -l
java-1.5.0-sun 53 /usr/lib/jvm/java-1.5.0-sun
java-gcj 1041 /usr/lib/jvm/java-gcj
my-id@my-pc:~/Projects/eclipse$ update-java-alternatives -v -s java-1.5.0-sun
update-java-alternatives: no root privileges
my-id@my-pc:~/Projects/eclipse$ sudo update-java-alternatives -v -s java-1.5.0-sun
Password:
resetting java alternatives
Using `/usr/lib/jvm/java-1.5.0-sun/bin/appletviewer' to provide `appletviewer'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/apt' to provide `apt'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/extcheck' to provide `extcheck'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/HtmlConverter' to provide `HtmlConverter'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/idlj' to provide `idlj'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jarsigner' to provide `jarsigner'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jar' to provide `jar'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/javac' to provide `javac'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/javadoc' to provide `javadoc'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/javah' to provide `javah'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/javap' to provide `javap'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/java-rmi.cgi' to provide `java-rmi.cgi'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jconsole' to provide `jconsole'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jdb' to provide `jdb'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jinfo' to provide `jinfo'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jmap' to provide `jmap'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jps' to provide `jps'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jsadebugd' to provide `jsadebugd'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jstack' to provide `jstack'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jstatd' to provide `jstatd'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/jstat' to provide `jstat'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/native2ascii' to provide `native2ascii'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/rmic' to provide `rmic'.
Using `/usr/lib/jvm/java-1.5.0-sun/bin/serialver' to provide `serialver'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/ControlPanel' to provide `ControlPanel'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/java' to provide `java'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/java_vm' to provide `java_vm'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/javaws' to provide `javaws'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/keytool' to provide `keytool'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/orbd' to provide `orbd'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/pack200' to provide `pack200'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/policytool' to provide `policytool'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/rmid' to provide `rmid'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/rmiregistry' to provide `rmiregistry'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/servertool' to provide `servertool'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/tnameserv' to provide `tnameserv'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/unpack200' to provide `unpack200'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so' to provide `firefox-javaplugin.so'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so' to provide `iceape-javaplugin.so'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so' to provide `iceweasel-javaplugin.so'.
Using `/usr/lib/jvm/java-1.5.0-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so' to provide `mozilla-javaplugin.so'.
my-id@my-pc:~/Projects/eclipse$

And even though the Eclipse pages say that Eclipse does not look at JAVA_HOME it does seem to care:

my-id@my-pc:~/Projects/eclipse$ eclipse
using specified vm: /usr/java/j2sdk1.4.2
my-id@my-pc:~/Projects/eclipse$ update-java-alternatives -l
java-1.5.0-sun 53 /usr/lib/jvm/java-1.5.0-sun
java-gcj 1041 /usr/lib/jvm/java-gcj
my-id@my-pc:~/Projects/eclipse$ export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
my-id@my-pc:~/Projects/eclipse$ eclipse
using specified vm: /usr/lib/jvm/java-1.5.0-sun
Could not create /usr/local/lib/eclipse/.eclipseextension. Please run as root:
touch /usr/local/lib/eclipse/.eclipseextension
chmod 2775 /usr/local/lib/eclipse/.eclipseextension
chown root:staff /usr/local/lib/eclipse/.eclipseextension

Did I mention that your first run of Eclipse should be as a root id so that it can create /usr/local/lib/eclipse/.eclipseextension

my-id@my-pc:~/Projects/eclipse$ sudo eclipse
Password:
using specified vm: /usr/lib/jvm/java-1.5.0-sun
cbcalvin@natalie:~/Projects/eclipse$ eclipse
using specified vm: /usr/lib/jvm/java-1.5.0-sun
Mar 15, 2008 5:20:27 PM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Mar 15, 2008 5:20:27 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5
Mar 15, 2008 5:20:27 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Mar 15, 2008 5:20:28 PM org.apache.catalina.loader.WebappLoader start
INFO: Dual registration of jndi stream handler: factory already defined
Mar 15, 2008 5:20:28 PM org.apache.catalina.loader.WebappLoader setClassPath
INFO: Unknown loader org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@1087be0 class org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader
Mar 15, 2008 5:20:29 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-127.0.0.1-49371
Mar 15, 2008 5:20:29 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-127.0.0.1-49371
cbcalvin@natalie:~/Projects/eclipse$ eclipse
using specified vm: /usr/lib/jvm/java-1.5.0-sun

After doing these things, Eclipse seems to work fine if a bit sluggish from a lack of memory. I will probably provide some more on this topic later.

One Reply to “Eclipse”

  1. Going back the next day, I realized that the new logon would reset the environment settings. Thanks to gborbolla of the Ubuntu forumsI created a script to recreate the environment.

    #!/bin/sh
    export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun

    #/usr/java/eclipse/eclipse -vm $JAVA_HOME/jre/bin/java -Xmx128M
    eclipse

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.