Total Eclipse in Gentoo

Gentoo does really have Eclipse SDK in its portage. I once used it a long time ago and I gave up soon after I learned that it’s more difficult to update the portage version of Eclipse (at least to me).

Now I decided to install Eclipse Europa, and grabbed myself a Gtk version of Europa and extracted in /opt.

When when /opt/eclipse/eclipse was started, Eclipse stopped the execution, giving me the following error message.

 JVM terminated. Exit code=1/usr/bin/run-java-tool
-Xms40m
-Xmx256m
-Dosgi.bundlefile.limit=100
-jar /opt/eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar
-os linux
-ws gtk
-arch x86
-showsplash
-launcher /opt/eclipse/eclipse
-name Eclipse
--launcher.library /opt/eclipse/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.0.v20070606/eclipse_1017a.so
-startup /opt/eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar
-exitdata d5801b
-vm /usr/bin/run-java-tool
-vmargs
-Xms40m
-Xmx256m
-Dosgi.bundlefile.limit=100
-jar /opt/eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar

It seemed like vanilla Eclipse didn’t really want to work with Gentoo’s Java environment.

So I added a path to Java VM when starting Eclipse, and it began to work.

./eclipse -vm `java-config-2 --java`

It was because eclipse was running Gentoo’s run-java-tool instead of java, and this made $tool variable in line 15 of run-java-tool to become “run-java-tool” instead of “java”. Then it leads to wrong interpretation of JVM path.

It can also be fixed by adding

[[ $tool = "run-java-tool" ]] && tool="java"

(replace & with actual ampersand symbol)
after line 15,

tool=$(basname $O)

Or alternatively, you can directly call Equinox (Eclipse Launcher) by using the examples described in Eclipse Wiki. Here’s the sample bash script:

#!/bin/bash# set path to eclipse folder. If local folder, use '.'; otherwise, use /path/to/eclipse/
eclipsehome=".";
# get path to equinox jar inside $eclipsehome folder
cp=$(find <em>$eclipsehome</em> -name "org.eclipse.equinox.launcher_*.jar" | sort | tail -1);
# start Eclipse w/ java
/opt/java50/bin/java -cp $cp org.eclipse.equinox.launcher.Main ...

Leave a Reply

Turn on pictures to see the captcha *