Skip to content

Instantly share code, notes, and snippets.

@mrsrvman
Forked from hgomez/download-java8.sh
Created January 18, 2020 19:17
Show Gist options
  • Save mrsrvman/865250abd8fefb953e4e58b405c999b3 to your computer and use it in GitHub Desktop.
Save mrsrvman/865250abd8fefb953e4e58b405c999b3 to your computer and use it in GitHub Desktop.
wget to download Java 8
wget --continue --no-check-certificate -O jdk-8-linux-x64.tar.gz --header Cookie: oraclelicense=a http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-x64.tar.gz
@mrsrvman
Copy link
Author

$ url=$(curl -s https://www.java.com/en/download/linux_manual.jsp | grep -E ".*x64.*javadl" | grep -v "RPM" | sed "s/.href="//g;s/".//g" | head -n 1)

like https://javadl.oracle.com/webapps/download/AutoDL?BundleId=239848_230deb18db3e4014bb8e3e8324f81b43

$ wget -c --content-disposition $url

$ ls -hat | grep jre- | head -n1

like jre-8u221-linux-x64.tar.gz?GroupName=JSC&FilePath=%2FESD6%2FJSCDL%2Fjdk%2F8u221-b11%2F230deb18db3e4014bb8e3e8324f81b43%2Fjre-8u221-linux-x64.tar.gz&BHost=javadl.sun.com&File=jre-8u221-linux-x64.tar.gz&AuthParam=1568796866_8a2e7120e2372d

$ old=$(ls -hat | grep jre- | head -n1)

$ echo $old | awk -F"?" '{print $1}'

like jre-8u221-linux-x64.tar.gz

$ mv $old $(echo $old | awk -F"?" '{print $1}')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment