How to automate download and installation of Java JDK on Linux?

Source : http://stackoverflow.com/questions/10268583/how-to-automate-download-and-installation-of-java-jdk-on-linux UPDATED FOR JDK 8u45 RPM: wget –no-check-certificate –no-cookies –header « Cookie: oraclelicense=accept-securebackup-cookie » http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm TAR GZ: wget –no-check-certificate –no-cookies –header « Cookie: oraclelicense=accept-securebackup-cookie » http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jdk-8u40-linux-x64.tar.gz RPM using curl: curl -v -j -k -L -H « Cookie: oraclelicense=accept-securebackup-cookie » http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm > jdk-8u45-linux-x64.rpm -j -> junk cookies -k -> ignore certificates -L -> follow redirects -H [arg] -> headers curl can …