After I wrote the previous post, I found out I should not have configured Java like that. So after following some tips from the comments and from “Installing Sun’s Java environment in Debian systems” here is a better way to do it:
- Go Repositories/Ubuntu where you will find information on how to add the “Universe” repository.
- Open your Synaptic Package Manager and search for java-package. Mark for install and apply.
- After downloading the JDK bin file, go to a terminal and type
- make-jpkg jre-1_5_0_03-linux-i586.bin
- sudo dpkg -i sun-j2sdk1.5_1.5.0+update09_i386.deb
- sudo update-alternatives –config java (here choose the one that points to the JDK you installed)
- sudo update-alternatives –config javac
This is a better way since it will take care of the system variables for every user (you can verify that java and javac are working on the console) and it will be easier to manage updates.
If you’re using Eclipse you need to update the Installed JREs in Window->Preferences->Java and add a new one that points to /usr/lib/j2sdk1.5-sun/ e.g..
Hi Ana,
You could also (once you’d added universe) typed ‘apt-get install sun-java5-jdk’.
Sun java packages have been available for ubuntu for a while.
I wonder where that ‘sudo update-alternatives –config java’ stores its’ settings.
From what I could see, update-alternatives modifies the symbolic links in /etc/alternatives.
e.g. /usr/bin/java is a symlink to /etc/alternatives/java, which in turn is a symlink to the chosen java binary, which is /usr/lib/jvm/java-1.5.0-sun/bin/java on my machine
And as Wouter said, all this is done with a simple ‘sudo aptitude install sun-java5-jdk’ now (you still have to to enable universe/multiverse repositories, though).
Hi Anna,
What is a good way to installing Java on Ubuntu?