I've upgraded to Ubuntu 11.04 on my netbook a while back and as usual, I can't install Java the "official" way because the Ubuntu 11.04 Partner repository is not yet ready (it's usually available once the final Ubuntu version is released).
So what are the options for installing Java in Ubuntu 11.04 if you upgrade before the final version is released? You can download it from its website and install it manually and/or use the JDK updater script provided by Bruce Ingalls - but there are actually 2 much easier to use alternatives. Read on!
1. Install Java (JRE / JDK and the Java Plugin) In Ubuntu 11.04 Natty Narwhal using the Ubuntu 10.10 Partner repository
Press ALT + F2 and enter the following:
gksu /usr/bin/software-properties-gtk
Then, on the "Other software" tab click "Add" and add the following:
deb http://archive.canonical.com/ubuntu maverick partner
Now reload the software sources and search for "sun jre" (or "sun jdk" if you want to install Java JDK) in the Ubuntu Software Center.
If you want to install Java JRE and the Java plugin via command line, copy/paste the following command in a terminal:
If you want to install Java JRE and the Java plugin via command line, copy/paste the following command in a terminal:
sudo apt-get install sun-java6-jre sun-java6-plugin
For JDK, use:
sudo apt-get install sun-java6-jdk
2. Install Java in Ubuntu 11.04 via PPA
There is another way to install Java in Ubuntu 11.04 Natty Narwhal: via a repository provided by lffl.org.
Add the PPA and install Java in Ubuntu 11.04 using the following commands:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin
For JDK, use:
sudo apt-get install sun-java6-jdk
Update: also see: How To Install Oracle Java 7 (JDK) In Ubuntu and Install Oracle Java (JDK) 7 in Ubuntu via PPA Repository
Thanks to lffl.org for the Ubuntu 11.04 Java PPA!