Another way to install Java JDK 8

I have written on and improved upon the installation process for Oracle's Java JDK over the years.  Creating a script with a hard-coded filename has a considerable drawback, particularly as it pertains to Java JDK. Oracle updates their product often and with a naming convention that doesn't permit for any reasonable guess as to what the next version should be.  I managed to create a script to download and install the latest version of Java JDK without hard-coding the name.

At the time of this writing, the script has been tested to work successfully with a fresh install of the application, however, more tweaking is needed for upgrades. Without further ado, here is that script.

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "$(curl -s http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html | grep "jdk-8u" | grep "linux-x64.tar.gz" | grep -o 'http.*' | cut -d"\"" -f1 | tail -1)"
tar xzvf jdk-8u*linux-x64.tar.gz
chown -R root:root jdk*/
ln -s $(ls -d jdk*/) java

Some explanation of the script. The use of curl essentially downloads the webpage, parses only the jdk-8u and then more specifically linux-x64.tar.gz.  Since there are two versions of Java JDK, tail is used to select the latter of the two versions, being the more recent of the two.

You can read through my other Java JDK write-ups, this is a good routine to use.