Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

How to Install Java8 on Ubuntu 14.04

 
Marshal
Posts: 65089
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought I knew how to install Java®, but it doesn't seem to work on Ubuntu14.04. Maybe I shouldn't have installed it when it first came out. Until early this week, I used Ubuntu 13.10 on a Chromebook and Java7 and Java8 both worked nicely. Not on Ubuntu14.04, however.
I can try

sudo apt-get install openjdk-7-jdk
javac -version
java -version

… and it tells me 1.7.0_51 IcedTea etc. I haven't found an OpenJDK version of Java8, so I tried the usual technique of unzipping the Oracle download into /usr/java (which I have created and given “campbell” ownership of).

campbell@xxxxx:~$ /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:~$ /usr/java/jdk1.7.0_55/bin/java -version
bash: /usr/java/jdk1.7.0_55/bin/java: No such file or directory

Same download in my home directory as I had last week. I repeated the download and got the same error. It is different from the error for Oracle Java7, which I haven't actually got installed at the moment.

Anybody else seen that sort of thing? I shall probably revert to Ubuntu13.10 for a bit.
Shall probably ask the same question on www.linuxforums.com
 
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:I thought I knew how to install Java®, but it doesn't seem to work on Ubuntu14.04. Maybe I shouldn't have installed it when it first came out. Until early this week, I used Ubuntu 13.10 on a Chromebook and Java7 and Java8 both worked nicely. Not on Ubuntu14.04, however.
I can try

sudo apt-get install openjdk-7-jdk
javac -version
java -version

… and it tells me 1.7.0_51 IcedTea etc. I haven't found an OpenJDK version of Java8, so I tried the usual technique of unzipping the Oracle download into /usr/java (which I have created and given “campbell” ownership of).

campbell@xxxxx:~$ /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:~$ /usr/java/jdk1.7.0_55/bin/java -version
bash: /usr/java/jdk1.7.0_55/bin/java: No such file or directory

Same download in my home directory as I had last week. I repeated the download and got the same error. It is different from the error for Oracle Java7, which I haven't actually got installed at the moment.

Anybody else seen that sort of thing? I shall probably revert to Ubuntu13.10 for a bit.
Shall probably ask the same question on www.linuxforums.com



I'm sure I've seen something similar at work. I can't for the life of me remember what the problem was, but two things spring to mind:

1) Did you install a 64-bit binary into a 32-bit OS? That might explain the 'Exec format error'
2) Did your download get corrupted? Do oracle supply an MD5 or SHA checksum?
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A quick search online for 'Exec format error' brings up posts where people have been mixing up 64-bit and 32-bit architecture so that sounds promising, and it does ring a bell from when I saw the problem.
 
Campbell Ritchie
Marshal
Posts: 65089
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All 64 bits, as far as I can remember.
 
Campbell Ritchie
Marshal
Posts: 65089
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think Oracle supply SHAs or other checksums, but I started with the same download I had used previously, and replaced it with a new download, so I don't think that was the problem.

And thank you
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:I don't think Oracle supply SHAs or other checksums, but I started with the same download I had used previously, and replaced it with a new download, so I don't think that was the problem.

And thank you




You're welcome.

I'm curious now though, so I'll download Trusty Tahr and give it a go...
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well it's not just you, I got exactly the same error. Don't have time to investigate right now though. Will look more closely later.
 
Campbell Ritchie
Marshal
Posts: 65089
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. And you heard it first on this channel. No replies here, yet.
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've just checked and I accidentally downloaded the 32 bit version of ubuntu (not sure how I managed that). I'm downloading the 64 bit version now to see if that fixes it. Run ld /path/to/java and see what error it gives. On mine it tell me that:

ld: i386:x86-64 architecture of input file `/usr/local/java/jdk1.8.0_05/bin/java' is incompatible with i386 output



If yours gives you something similar then you're running a 64-bit binary on a 32-bit architecture.

You can also try uname -a to verify the architecture you have installed.
 
Campbell Ritchie
Marshal
Posts: 65089
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, but as far as I can see I have only had 64 bit versions:

campbell@xxxxx:~$ cd Downloads/
campbell@xxxxx:~/Downloads$ ls u*
ubuntu-13.10-desktop-amd64.iso ubuntu-14.04-desktop-amd64.iso
campbell@xxxxx:~/Downloads$ ls jdk*
jdk-7u55-linux-x64.rpm jdk-7u55-linux-x64.tar.gz jdk-8u5-linux-x64.tar.gz

No i586 versions in the jdks or the isos.
 
Ranch Hand
Posts: 411
5
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open your terminal window in Ubuntu 14.04 && copy and paste in the following commands:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Thank you, but as far as I can see I have only had 64 bit versions:

campbell@xxxxx:~$ cd Downloads/
campbell@xxxxx:~/Downloads$ ls u*
ubuntu-13.10-desktop-amd64.iso ubuntu-14.04-desktop-amd64.iso
campbell@xxxxx:~/Downloads$ ls jdk*
jdk-7u55-linux-x64.rpm jdk-7u55-linux-x64.tar.gz jdk-8u5-linux-x64.tar.gz

No i586 versions in the jdks or the isos.



I really hate to say it, but it works on my machine (now I actually installed the 64-bit version of Ubuntu).
 
Campbell Ritchie
Marshal
Posts: 65089
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it to work by reinstalling Ubuntu13.10. I am now using the upgrade function rather than the .iso, and I shall see what happens.

And thank you for your help.
 
Rico Felix
Ranch Hand
Posts: 411
5
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:I got it to work by reinstalling Ubuntu13.10. I am now using the upgrade function rather than the .iso, and I shall see what happens.

And thank you for your help.



Why would you do that when you can use the following command line options in the first place:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Screenshot-from-2014-04-19-16-28-54.png
[Thumbnail for Screenshot-from-2014-04-19-16-28-54.png]
Screenshot
 
Campbell Ritchie
Marshal
Posts: 65089
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, RF. I shall try to remember to put those instructions in the FAQ. Somebody on the other website posted a link with the same instructions on.

The reason for using the download installation method is that I am not used to Ubuntu; I have mostly used RPM versions of Linux in the last few years and haven't used Ubuntu a lot. I only knew about the command line option for Java6.

And I think I must have used a 32-bit installation and thought it was 64 bits; that appears to be the only way to get such an error message. Sorry for confusing people.
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use same method mentioned by Rico.

In addition to that, once we install Oracle JDK via webup8team ppa, it is very easy to switch between JDK.

e.g. fire below command:

Done. Now all your Java utilities (javac, java, javadoc etc.) are defaulted to Oracle JDK 7.

This works only for switching between Oracle JDK though (helpful for me because I have Oracle JDK 6, 7 and 8 )
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!