Unable to locate package oracle-java8-installer - What do I do?

464    Asked by NeilWallace in Java , Asked on Oct 12, 2022

 I've been using the Dockerfile below to install java8. However, all of a sudden while creating the docker image it breaks with error

E: Unable to locate package oracle-java8-installer

E: Unable to locate package oracle-java8-set-default


FROM ubuntu:trusty-20151218

ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
RUN echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' >> /etc/apt/sources.list &&
    echo 'deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' >> /etc/apt/sources.list &&
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C2518248EEA14886 &&
    apt-get update &&
    echo oracle-java${JAVA_VER}-installer shared/accepted-oracle-licence-v1-1 select true | sudo /usr/bin/debconf-set-selections &&
    apt-get install -y --force-yes --no-install-recommends oracle-java${JAVA_VER}-installer oracle-java${JAVA_VER}-set-default &&
    rm -rf /var/cache/oracle-jdk${JAVA_VER}-installer
    echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommends
    && echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends
    && DEBIAN_FRONTEND=noninteractive apt-get install -y vim.tiny wget sudo net-tools ca-certificates unzip
    && apt-get clean
    && rm -rf /var/lib/apt/lists/*

Answered by Nicholas Walsh

As you are unable to locate package oracle-java8-installer,

You're asking to install OpenJDK. The webupd8team PPA install Oracle Java.

For the record though, I had the same problem installing Oracle Java. Opening a root terminal at /etc/apt/sources.list.d/, I renamed webupd8team-java-precise.list to webupd8team-java.list then ran

sudo apt-get update

sudo apt-get install oracle-java8-installer

Your Answer


Parent Categories