The simplest way to get started with Java development in Gentoo is to install the Blackdown JDK-1.4.2 along with the Eclipse IDE:
$ emerge blackdown-jdk eclipse-sdk
if you want to install the sun's version of the jdk, instead of blackdown jdk, you can get the 1.4.2 version of it using:
$ emerge sun-jdk java-sdk-docs
to install the 1.5 version of the jdk, you need to unmask it first. add the following two lines to your /etc/portage/package.keywords file:
>=dev-java/sun-jdk-1.5.0 ~x86
>=dev-java/java-sdk-docs-1.5.0 ~x86
now do the emerge:
$ emerge sun-jdk java-sdk-docs
you can also install both of these versions at the same time, and then make one of them as the default jdk. if you need java support in other applications too(like web browser etc), then make sure to add the relevant keywords in the /etc/portage/package.use file:
=dev-java/sun-jdk-1.4.2.10-r2 X alsa browserplugin doc examples jce mozilla nsplugin
this also installs the documentation and the examples. change the version number if you are installing the 1.5 version of the jdk.
if you want to use Eclipse IDE to create C++ programs, you need the eclipse-cdt package. first unmask it by placing the following line in /etc/portage/package.keywords file:
>=dev-util/eclipse-cdt-2.0 ~x86
now do the emerge:
$ emerge eclipse-cdt
here is more information on installing java 1.5 and eclipse 3.x on Gentoo OS.



browe said
When I installed these everything worked fine. Tomcat runs fine with blackdown. Eclipse says no java by default. not sure why. I used java-config to set blackdown as my default system jvm.
Probably need a little more setup instructions than this.
tabreziqbal said
if you have done this:
$ emerge blackdown-jdk eclipse-sdk
Eclipse should already be configured to use the blackdown-jdk. if there is no JRE configured in Eclipse for some reason, you can add one by yourself; instructions on how to do it are here:
http://tabreziqbal.wordpress.com/2006/04/01/java-15-and-eclipse-in-gentoo-part-ii/
look for the second paragraph from the bottom of the post.
though it is for adding sun-jdk-1.5 JRE, the procedure is the same to add blackdown-jdk JRE too. let me know if that helps.
Every Flavour Beans » Java 1.5 and Eclipse in Gentoo - Part II said
[...] my previous post discussed the installation of Java on a Gentoo system. its all well as long as you want to run the default supported version of java on the Gentoo system – you install blackdown-jdk 1.4, Eclipse 3.0, and maybe Eclipse CDT too. but if you want to install java 1.5(Tiger), then you need to unmask the package and remember to make blackdown(or sun) jdk 1.4 as the default JVM for the system. you can keep sun jdk 1.5 as the default JVM for the user. the procedure is like this: [...]