This is a very basic post, but I consider it for myself rather for public consumption. I needed to download the Java RPM from the Oracle website from command line, as I’m connected to my systems from a low bandwidth site.
I needed to find the cookies that Oracle website uses for “accepting” Oracle license to use properly wget from command line. Here it is:
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/7u71-b14/jdk-7u71-linux-x64.rpm
And below the commands to set right alternatives in CentOS/RHEL:
alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_71/bin/java 2 alternatives --config java alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_71/bin/jar 2 alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_71/bin/javac 2 alternatives --set javac /usr/java/jdk1.7.0_71/bin/javac