Archive for Java

Java 1.5 and Eclipse in Gentoo – Part II

This blog is moved to the new location:

You can read the same article at its new location: Java 1.5 and Eclipse in Gentoo – Part II

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:

$ java-config -L

[sun-jdk-] “Sun JDK” (/etc/env.d/java/20sun-jdk- *
[blackdown-jdk-] “Blackdown JDK” (/etc/env.d/java/20blackdown-jdk-

this shows you all the installed jdks on your system. use the name as given under the brackets to set that particular jvm as your system default:

$ java-config -S blackdown-jdk-
$ /usr/sbin/env-update && source /etc/profile

this sets the blackdown jdk 1.4 as the system jvm, which is the recommended option. you can set the sun jdk 5.0 as the user default jvm though:

$ java-config -s sun-jdk-
$ echo source ~/.gentoo/java-env >> ~./bash_profile
$ source ~/.gentoo/java-env

this sets the sun jdk 1.5 as the user jvm and it is safe this way. but don’t make 1.5 version as the default jvm for the system unless you are ready to break a lot of java applications.

Best way to install Java on Gentoo OS:

but this still is not an ideal setup from my point of view; the installed Eclipse version doesn’t support the Java 1.5 version. if you want to use the latest versions of all the java software without going through all of these hassles, then you need to install everything related to java manaully in the user home directory. this won’t affect your normal portage structure.

first download the latest versions of java sdk and the eclipse ide from the internet and copy them into the home directory.

download sun jdk 1.5.0 update 6 from here and copy it into the home directory. you will have to accept the license to be able to download this. be sure to download the .bin version of the file, and not the rpm version.

download the latest version of the eclipes ide from here and copy it in the home directory. the latest build available currently is Eclipse 3.2M5a. If you plan to use Eclipse CDT plugin to create C++ applications, then you have to be content with the Eclipse 3.1.2 version.

(all the above links are for the gnu/linux, 32-bit operating system. finding similar package files for 64-bit systems shouldn’t be too difficult)

install jdk as a normal user:

$ chmod +x jdk_1_5_0_06-linux-i586.bin
$ ./jdk_1_5_0_06-linux-i586.bin
$ tar xvzf eclipse-sdk-3,1,2-linux-gtk.tar.gz

rename the directory to which the above files are extracted to something simple, like “eclipse”.

now add the following lines to your user profile( eg ~/.bash_profile ):

PATH=~/jdk1.5.0_06/bin:~/jdk1.5.0_06/jre/bin:~/eclipse:$PATH MANPATH=$MANPATH:~/~/jdk1.5.0_06/man

source the profile once and start the eclipse IDE:

$ source ~./bash_profile
$ eclipse

Go to Windows menu and select Preferences from it. Select Java -> Installed JREs from the left pane and click on the “Add” button on the right pane. browse to and select jdk1.5.0_06/jre directory from your home directory. enter “JDK1.5.0_06” in “JRE Name:” field. click on Java -> Compiler item from the left pane and select “5.0” from the “Compiler Compliance Settings:” selection list. Click OK button to dismiss the dialog box.

Now you can create java 1.5 applications on your Gentoo system using the Eclipse IDE.
just extract the Eclipse CDT tar file in the eclipse folder to get the C++ support in Eclipse. (contents of ‘features’ directory from downloaded package should go into the ‘features’ directory in eclipse, and contents of ‘plugins’ directory should go into the ‘plugins’ directory in eclipse).


Comments (1)

Java on Gentoo

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- 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.

Comments (3)