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

后端 未结 4 2069
执笔经年
执笔经年 2021-01-31 08:41

I tried to install java8 using the following commands:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-install         


        
4条回答
  •  不知归路
    2021-01-31 09:30

    I just went through the same process and I fixed the problem by manually installing java 8 on my ubuntu 18.04 machine. Hopefully my answer will help you.

    1. Download the latest JAVA 8 SE development kit from here: https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
    2. Open your terminal.
    3. Type $mkdir /opt/jdk.
    4. Untar Java in your new folder $tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk.
    5. Set oracle JDK as the default JVM by running those two instructions (or something around that depending on your configuration):

    Note: Each bullet point is one single command

    • update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_/bin/java 100
    • update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_/bin/javac 100

    You can check the result by running java -version !

    Before I started, I went through those steps as well in order to remove completely java from my system: https://askubuntu.com/questions/84483/how-to-completely-uninstall-java#185250

    The source I used for the manual installation of JAVA was this article: https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps

提交回复
热议问题