Not able to install oracle jdk on CentOS machine using wget

Viewed 6998

I want to install oracle java jdk 8 on CentOS I am not able to install java jdk because when I try to install java jdk using command

[root@ADARSH-PROD1 ~]# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b27/jdk-8u131-linux-x64.rpm"

I receive output:

Connecting to edelivery.oracle.com 
(edelivery.oracle.com)|23.211.196.232|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u131-b27/jdk-8u131-    linux-x64.rpm?AuthParam=1495864027_230ebffd10615c26528e8d2496500338 [following]
--2017-05-27 11:15:07--  http://download.oracle.com/otn-pub/java/jdk/8u131-    b27/jdk-8u131-linux-x64.rpm?    AuthParam=1495864027_230ebffd10615c26528e8d2496500338
Connecting to download.oracle.com (download.oracle.com)|184.25.109.32|:80...     connected.
HTTP request sent, awaiting response... 404 Not Found
2017-05-27 11:15:09 ERROR 404: Not Found.
4 Answers

This kind of thing comes up repeatedly. The fundamental issue is that Oracle want you to read and agree to the license terms.

It is a legal thing. If you can implement a scheme where you can automate the downloading without a human being clicking the "I agree" button, there is a chance that some Judge may rule that the agreement terms do not apply to you.

Therefore, Oracle try to make it hard (or at least ... not simple) to automate downloads of the "free" versions of Java. And every now and then they change the mechanisms.

A couple of ways to deal with this would be:

  1. Ask Oracle if they would give you access to a stable download site (presumably with password access control) if you payed for a license. (I actually don't know if they do.)

  2. Manually download the distro for each version of Java that you need and save them in a safe private place1. Then change your automatic deployment code to fetch distros from that location.

  3. Switch to a 3rd-party provider of OpenJDK; e.g. a Linux package source, or one of providers who make OpenJDK binary distros available for free and unrestricted download.

I'm aware that all of the above entail some effort. But then so does "faffing about" with scripted downloads from "http://download.oracle.com" each time there is an unheralded change.


1 - 1) Check with your lawyers first. I think that the license allows this, but IANAL. 2) Do not deliberately or accidentally publish them, or you are liable to be on the wrong end of a copyright violation lawsuit!

For me, using wget directly on my remote Linux server failed every time no matter the script used. It was either downloading the file as HTML or not downloading at all.

The best and surest way to do this install is to

  1. Forget wget and download the file directly to your system
  2. Use WinSCP or any other free SFTP or FTP client to transfer the file to your server
  3. And then run yum localinstall <file-name.rpm> from the file location.
Related