How to install Java on Kubuntu 10.10

Yep, I have Kubuntu too installed on my machine and I love it. But… There are still some stuff that a newbie like me will find hard to achieve. Sometimes even such obvious task as installing Java will surprise me with some unexpected challenges, but hey, we’re not afraid of them, are we? I could not find the answer on Google, but I was lucky that my good friend Boris gave me a hand. Here are the steps we took to have it up and running:

1. First of all, you want to make sure you don’t have Java installed already. Open the terminal and type:

java -version

In my case, this gave me this output:

The program ‘java’ can be found in the following packages:
* gcj-4.4-jre-headless
* gcj-4.5-jre-headless
* openjdk-6-jre-headless

2. You will need to check if the file /etc/apt/sources.list has these two lines commented out (meaning that they have # in front)

# deb http://extras.ubuntu.com/ubuntu maverick main
# deb-src http://extras.ubuntu.com/ubuntu maverick main

3. If that’s the case, you’ll have to go back to your terminal and type:

sudo kate /etc/apt/sources.list

This will open the same file in Kate, but you’ll have writing privileges. Find the above two lines and remove the # in their front and save the file.

4. Go back to the terminal and type:

sudo apt-get update

5. Type:

sudo apt-get install sun-java6-jdk

It will ask you if you’re OK to install Java that will take up a bunch of space on your hard drive, you should press the y key to agree and continue.

6. At the end you will get a window with the licence agreement, to get to press the OK button, you first have to hit the Tab key and than press Enter.

That was it for me, I hope it will help you.

Update
In case it doesn’t work for you, in step 3. uncomment:

deb http://archive.canonical.com/ubuntu maverick partner
deb-src http://archive.canonical.com/ubuntu maverick partner

Thanks Lars for the feedback!