2

I'm running Ubuntu 14.04. I'm trying to install Oracle java 8. I downloaded the .rpm file published by Oracle: jdk-8u20-linux-x64.rpm and then ran the following commands trying to install it:

$ sudo alien jdk-8u20-linux-x64.rpm  --scripts
$ sudo dpkg -i jdk1.8.0-20_1.8.020-1_amd64.deb

Those two commands seem to be working ok, and then I try to point java to default to this one, using the following command that fails: $ sudo update-java-alternatives -s java-8-oracle I get the message below:

update-java-alternatives: directory does not exist: /usr/lib/jvm/java-8-oracle

I tried to see what versions are available:

$ sudo update-java-alternatives -l
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64

Any ideas what may be wrong?

Regards C

2

1.Download java

http://www.oracle.com/technetwork/java/javase/downloads/index.html

2.Open terminal type commant

cd Downloads

tar xzvf jdk-8u25-linux-x64.tar.gz

sudo mkdir /usr/lib/jvm

sudo mv ~/Downloads/jdk1.8.0_25/ /usr/lib/jvm/

sudo chown -R root:root /usr/lib/jvm/jdk1.8.0_25

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_25/bin/java" 0

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_25/bin/javac" 0

sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_25/bin/java

sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_25/bin/javac

sudo gedit ~/.bashrc
    export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_25
    export PATH=$PATH:$JAVA_HOME/bin

. ~/.bashrc

java -version

echo $JAVA_HOME

echo $PATH
  • There is a PPA for that. – A.B. Jul 5 '15 at 10:51
  • I've never set the $JAVA_HOME, and that still seemed to work. – user1993392 Jul 5 '15 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.