Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (13.1k points)

I was trying to install Java 8 using these commands:

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer

But it throws an error:

Package oracle-java8-installer is not available, but is referred to by another package.

This may mean that the package is missing, has been obsoleted, or

is only available from another source

E: Package 'oracle-java8-installer' has no installation candidate

Can anyone help me with this?

1 Answer

0 votes
by (26.7k points)

Basically, you can try manually install Java 8 on ubuntu machine. In able to do that, follow these steps:

1. You need to download the latest Java 8 Development kit.

2. After that, type the command $mkdir /opt/jdk

3. After that, we need to untar java in new folder like : $tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

4. Then, set oracle JDK as default JVM using commands:

update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_<YourVersion>/bin/java 100

update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_<YourVersion>/bin/javac 100

I hope this will help.

Want to become a Java expert? join Java Training now!!

Related questions

0 votes
1 answer
asked Mar 24, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer
asked Feb 6, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer
0 votes
1 answer
asked Aug 13, 2019 in Java by Nigam (4k points)

Browse Categories

...