Centos – Install Oracle Java 8 from RPM package

centos-7javarpmyum

I tried install Java8v112 from RPM package with oracle instructions:
https://java.com/en/download/help/linux_x64rpm_install.xml

I got error which begins:

error: open of <html> failed: No such file or directory
error: open of <head> failed: No such file or directory
error: open of <title>Unauthorized failed: No such file or directory

I got Centos 7. I tried on two servers. I am able to install it differently, but I am really curious why it doesn't work?

Usually I get the rpm and install it with yum. Here installation fails with yum and rpm command.

yum output:

Cannot open: jdk-8u112-linux-x64.rpm. Skipping.

Best Answer

Oracle has special mechanism to download files from them. I wrote just wget and download link. It did not download the full file.

Solution is to click through their site with accepting licence or to write wget like this:

 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/8u112-b15/jdk-8u112-linux-x64.rpm"

After that you can install java with yum:

 yum install jdk-8u112-linux-x64.rpm
Related Question