Java 1.5 and Eclipse in Gentoo – Part II

This blog is moved to the new location: beans.seartipy.com

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-1.5.0.06] “Sun JDK 1.5.0.06” (/etc/env.d/java/20sun-jdk-1.5.0.06) *
[blackdown-jdk-1.4.2.03] “Blackdown JDK 1.4.2.03” (/etc/env.d/java/20blackdown-jdk-1.4.2.03)

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-1.4.2.03
$ /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-1.5.0.06
$ 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 ):

JDK_HOME=~/jdk1.5.0_06
JAVAC=~/jdk1.5.0_06/bin/javac
PATH=~/jdk1.5.0_06/bin:~/jdk1.5.0_06/jre/bin:~/eclipse:$PATH MANPATH=$MANPATH:~/~/jdk1.5.0_06/man
JAVA_HOME=~/jdk1.5.0_06

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


					
Advertisements

1 Comment »

  1. […] here is more information on installing java 1.5 and eclipse 3.x on Gentoo OS. […]

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: