Installing Java on Ubuntu 11.04 Desktop

Asked by Julianloui

I am trying to installing Java on Ubuntu 11.04 Desktop in order to learn how to use logstash. I've installed logstash-1.1.9-monolithic.jar but need Java to proceed. I'll happy if I can get java installed first.

Julianloui

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

There are no packages and no support for Natty, it is EOL. I recommend a fresh install of Precise. It is LTS, supported til April 2017.

Revision history for this message
David Pires (slickymaster) said :
#2

Even though actionparsnip (andrew-woodhead666) advice is correct, you can still install Java if you want. Run the following commands in a terminal window:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install openjdk-6-jre-headless -y

Revision history for this message
Thomas Krüger (thkrueger) said :
#3

It is not a good idea to mix-up repositories for different Ubuntu versions. It might mess up the whole system.
And it is not a good idea to run a system that is not supported anymore.
So I also recommend to upgrade your installation.

Revision history for this message
Julianloui (julianloui) said :
#4

David,

I tried out your instructions this morning and the system responded as fololws.

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" --------> command ran error-free

sudo apt-get update ---------> command produced " /etc/apt/sources.list could not be read "

sudo apt-get install openjdk-6-jre-headless -y ------> command produced "Unable to locate package openjdk-6-jre-headless"

Thank you very for the suggestion.

Julianloui

Revision history for this message
David Pires (slickymaster) said :
#5

It seems those repositories for Natty are not available any more, and you should upgrade to Precise as its supported till April 2017.

But if you still want to install it anyway in your present box, download from http://www.oracle.com/technetwork/java/javase/downloads/index.html the 32bit "compressed binary file" - it has a ".tar.gz" file extension and uncompress it using this command at a terminal window:
tar -xvf jre-7-linux-i586.tar.gz

JRE 7 package is now extracted into ./jre1.7.0 directory. Now move the JRE 7 directory to /usr/lib running at a terminal window:
sudo mv ./jre1.7.0* /usr/lib/jvm/jre1.7.0

Afterwards run the following:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

Then, run:
sudo update-alternatives --config java

You will see output similar one below - choose the number of jdk1.7.0 - for example 3 in this list:
Selection Path Priority Status
————————————————————
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode
3 /usr/lib/jvm/jdk1.7.0/jre/bin/java 3 manual mode

Press enter to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/jdk1.7.0/jre/bin/java to provide /usr/bin/java (java) in manual mode.

If only one alternative is shown then choose it.

Finally check the version of you new JRE 7 installation, by typing the following at a terminal:
java -version

Revision history for this message
Julianloui (julianloui) said :
#6

2013-01-30
David,

Thank you very much for your detailed instructions. I finally installed Ubuntu 12.04 LTS on my relative's Windows 7 Professional system from a Ubuntu 12.04_desktop i386 (32-bit) CD two days ago. I 've also downloaded from www.java.com jre-7u11-linux-x64.tar.gz and extracted it aftwards. Now I see a jre1.7.0-11 folder in the home directory. When I entered java -version on the terminal a minute ago, the system returned

java version "1.6.0_24"
Open JDK Runtime Environment (IcedTea 1.11.5)
Open JDK Server vm (build 20.0-b12, mixed mode)

What puzzles me is that, I saw the above two java items even before I downloaded and extracted java from www.java.com two days ago. Did I unzip java incorrectly?

I can now connect to the Internet using the same Linksys wireless-g adapter as with Ubuntu 11.04 LTS before I replaced it with
Ubuntu 12.04 LTS on the same computer.

Since I must have java installed properly before I can start learning to use logstash, I'll appreciate your help in getting the right version of java set up in the computer in question.

Julianloui
immediately after I installed Ubuntu 12.04 LTS desktop.

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#7

www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

Revision history for this message
Julianloui (julianloui) said :
#8

Andrew,

Can you elaborate a little on your link? I wasn't able to access it. Thank you very much for your prompt response.

Julianloui

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#9

Run the commands in the link. What is there to elaborate?

Revision history for this message
Julianloui (julianloui) said :
#10

Andrew,

Thanks. I just re-downloaded OpenJDK.

Revision history for this message
Julianloui (julianloui) said :
#11

Thanks actionparsnip, that solved my question.