How to Install Java8 on Ubuntu 14.04

  • Thread starter Thread starter madcyclist
  • Start date Start date
M

madcyclist

I thought I knew how to do that; I have been using Java for programming for ages. I had Ubuntu 13.10 on an Acer Chromebook C720 until earlier this week, when I made the mistake of installing Ubuntu 14.04, Not only does it load more slowly, but also it gvies errors with Java. I can do this
Quote:
sudo apt-get install openjdk-7-jdk
java -version
...and get the appropriate response 1.7.0_51 IcedTea etc,
but I want to use Java8, so I did what I have always done, something like this
Quote:
cd /usr
sudo mkdir java
sudo chown campbell java
cd java
tar -zxvf ~/Downloads/jdk-8-etc-linux-etc.tar.gz
and got the usual output, a list of files being created. Now if I try to use it, things go wrong.
Quote:
campbell@xxxxx:~/java$ /usr/java/jdk1.8.0_05/bin/java -version
bash: /usr/java/jdk1.8.0_05/bin/java: cannot execute binary file: Exec format error
campbell@xxxxx:~/java$ java -version
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.6) (7u51-2.4.6-1ubuntu4)
OpenJDK Server VM (build 24.51-b03, mixed mode)
campbell@xxxxx:~/java$ java RussianMultiplication
Usage java RussianMultiplication <123> <456>
Default values 57 43 used
Multiply with * and /
57 * 43 = 2451
Multiply with << and >>
57 * 43 = 2451
campbell@xxxxx:~/java$ /usr/java/jdk1.8.0_05/bin/java RussianMultiplication
bash: /usr/java/jdk1.8.0_05/bin/java: cannot execute binary file: Exec format error
It works all right with OpenJDK but the Oracle version doesn't. Whether it was exactly the same download as last week or a new download, I get that error. Similarly for Oracle Java7

Anybody else ever seen that error? I shall probably revert to Ubuntu 13.10 for the time being.

I have asked the same question here: How to Install Java8 on Ubuntu 14.04 (Beginning Java forum at JavaRanch)

Continue reading...
 
Back
Top