Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apt-get installing oracle java 7 stopped working

Recently apt-get install -y oracle-java7-installer stopped working.

I know in their roadmap, I think the public version is no longer supported, but it's been working all the way until recently. http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Anyone have a work around for this?

http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1495560077_4041e14adcb5fd7e68827ab0e15dc3b1
Connecting to download.oracle.com (download.oracle.com)|96.6.45.99|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-05-23 10:19:17 ERROR 404: Not Found.
like image 762
ahong Avatar asked May 23 '17 18:05

ahong


People also ask

Is Java 7 still supported by Oracle?

As the Oracle Java SE Support Roadmap explains, Java SE 7 is planned to exit Extended Support and enter Sustaining Support in July 2022, after 11 years of fixes, security and other critical updates.


2 Answers

It appears Oracle has moved the download link, you can still fetch the tar ball from the oracle website after jumping through some hoops. The WebUpd8 installer is currently broken. The official explanation can be found at http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html


Download Method 1: Login into to Oracle site

The link now seems to be: http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz notice "otn" and not "otn-pub", but at least from the website you seem to need to be signed in and not only accept the license agreement.

It may be possible with debconf to change the url from otn-pub to otn and get the installer to work but I haven't tried. You can fetch the binary yourself and either install manually or with the installer pointing it to wherever you put the downloaded tar ball.

Edit: It seems there isn't a way to configure download URL (though you can hijack it with hosts as in another answer).

Download Method 2: Use a trusted mirror

If you want to download jdk-7u80-linux-x64.tar.gz from a script without logging into to oracle it hosted locations include:

  • http://ftp.osuosl.org/pub/funtoo/distfiles/oracle-java/
  • http://ftp.heanet.ie/mirrors/funtoo/distfiles/oracle-java/

EDIT: The sha256 has been removed from this answer because (as this edit demonstrates) anyone can edit said hash. Get your hashes from a trusted source. Suggestions include:

  • https://www.oracle.com/webfolder/s/digest/7u80checksum.html

Install Method 1: Prepopulate cache

#put the file in the default cache location:
sudo mv jdk-7u80-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/

#then install normally: 
sudo apt-get install oracle-java7-installer

Install Method 2: (more elegant IMHO) put tar ball anywhere and tell the installer where to look

#setup ppa (you probably came here after already doing this)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

#put the file in a temporary location:
sudo mv jdk-7u80-linux-x64.tar.gz /tmp/


#set local path to /tmp (or any other path)
echo oracle-java7-installer oracle-java7-installer/local select /tmp | \
sudo /usr/bin/debconf-set-selections


#While your at it you may want tp approve license (or skip this and approve when prompted) 
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | \
sudo /usr/bin/debconf-set-selections

#then install normally: 
sudo apt-get install oracle-java7-installer
like image 84
Meir Maor Avatar answered Sep 28 '22 05:09

Meir Maor


So looks like the direct links to the download no longer work( As noted by Meir Maor above)

Here are the steps to get this running again:

  1. Go to http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html and accept the license. Download the file we need (jdk-7u80-linux-x64.tar.gz in this case)

  2. Assuming the file downloaded to your Downloads directory, we need to move it to /var/cache/oracle-jdk7-installer

    cd ~/Downloads (Change to directory to which you saved file from step 1)
    sudo mkdir /var/cache/oracle-jdk7-installer
    sudo mv jdk-7u80-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/
    
  3. Not sure if necessary but I had luck with this:

    echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
    
  4. Run the installer now. It will use the file we saved in /var/cache instead of trying to download it from Oracle

    sudo apt-get install oracle-java7-installer
    

I got step 3 from http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

like image 29
soormacode Avatar answered Sep 28 '22 05:09

soormacode