Ubuntu 14.04 install Java 8 not working

5,583

If you want to use Oracle's JDK, another relatively easy solution is to download tar.gz archive of JDK 8 from oracle website. Extract it to location of your choice like /home/name/bin/ and add the following lines to end of your ~/.bashrc file:

export JAVA_HOME=/home/name/bin/jdk1.8.0_91  (subsitude with downloaded version)
export PATH=$JAVA_HOME/bin:$PATH

then run source ~/.bashrc and you are almost ready to go. If you want to install other packages that depend on jdk from apt-get you need to take extra steps explained in this answer. Otherwise installing them will result in automatic installation of OpenJDK.

Share:
5,583

Related videos on Youtube

khm
Author by

khm

Updated on September 18, 2022

Comments

  • khm
    khm over 1 year

    I'm using 14.04 on a VirtualBox 32 bit server. I am logged in as the sudo user.

    I am trying to install Java 8. I downloaded the file jre-8u101-linux-i582.rpm and used FTP to put it in the directory /jre. I try using the command rpm -ivh jre-8u101-linux-i582.rpm to extract and install it. When I do I get the error "failed dependencies" and then a long list of files that it apparently cannot find even though when I check in the specified directories the files are indeed there. When I researched the problem most people just said to use apt install.

    So I tried to do that. I did "apt-get update" then "apt-get install oracle-java8-installer". Then I got an error saying "unable to locate package oracle-java8-installer". So I tried "add-apt-repository ppa:webupd8team/java". This gives me the error "Cannot add PPA ... Please check that the PPA name or format is correct." So I tried "apt-get install --reinstall ca-certificates". According to most of the asks on here that should have worked. The actual process of the reinstall worked but it did not fix my problem. I also tried "-E add-apt-repository ppa:webupd8team/java" but that did not work and that shouldn't have applied anyway because I was not behind a proxy.

    So I need a solution to either the first problem or the second. Any help would be appreciated.

  • khm
    khm over 7 years
    my bash file was at /etc/bash.bashrc but besides that change this worked for me. thank you!