Installing Java 6 (1.6) in Linux
LinuxAfter experimenting with some other distros the past few weeks, I have come full circle and landed back on Ubuntu.... well... Kubuntu this time. After installing Edgy (6.10) I did the update-manager -c -d to upgrade to 7.04 (named Feisty Fawn). So far, I am really enjoying it. For an operating system that isn't even released yet and for a kernel that is less than a week old (kernel 2.6.20.10), it has been rock solid in my first day of really banging on it. One of the biggest adjustments for me is finding my way around KDE tools, but that is relatively minor.
One of the first things I had to do was set up my Eclipse environment. I figured this would be a good time to experiment with Java 1.6 (code name Mustang). From the reviews I have read, it is quite stable and is notably faster than 1.5 in many areas.
I had to jar my memory on the steps to set up a new JRE, so I decided this would make a good blog post in case others need to do the same.
First go to the Sun java download page and pull down the .bin file.
Once the .bin file ( jdk-6-linux-i586.bin in my case) is downloaded, you will need to make it executable. To do this run:
> sudo chmod +x jdk-6-linux-i586.bin
When this is done you can run the .bin file which extracts into a folder named jdk1.6.0 like this:
> ./jdk-6-linux-i586.bin
Now you will want to move that folder into a place with your other Java versions. On Ubuntu/Kubuntu/Xubuntu and probably others, this is in /usr/lib/jvm
> sudo cp -R jdk1.6.0 /usr/lib/jvm/
Historically, from this point I have usually made a symbolic link from /usr/bin/java to jre/bin/java and called it quits. Today I learned a cooler approach using the update-alternatives command. Before we do this next step, take a look at the output of this command:
> sudo update-alternatives --config java
As you can see, your new Java version is not in the list of possible alternatives (or at least it shoudn't be!). We are now going to "install" it so you can then choose it as an option and it will become the version used across your system. To do so run the following:
> sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0/jre/bin/java 300
This has accomplished a few things. We have created the symbolic link to our new java binary. We have then added this version of Java to the update-alternatives and have given it a priority level of 300.
Now go and run this again:
> sudo update-alternatives --config java
You should now see your new version and be able to select it by entering the appropriate number. To confirm that your system is now using Java 6, run the following:
> java -version
If all has gone well, you should hopefully see something like this:
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)
Now... off to config the rest of my system!






Loading....