这是坚持技术写作计划(含翻译)的第44篇,定个小目标999,每周最少2篇。
本文主要介绍如何使用wget下载可用的jdk8u221,介绍6种方式
如果只是安装jre即可,则可以使用(长期有效)
$ 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) $ wget -c --content-disposition $url $ old=$(ls -hat | grep jre | head -n1) $ mv $old $(echo $old | awk -F"?" '{print $1}')
不保证
$ wget -c --content-disposition "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=239835_230deb18db3e4014bb8e3e8324f81b43" $ old=$(ls -hat | grep jre | head -n1) $ mv $old $(echo $old | awk -F"?" '{print $1}')
windows jdk-8u221-windows-x64.exe
https://javadl.oracle.com/webapps/download/AutoDL?BundleId=239842_230deb18db3e4014bb8e3e8324f81b43
长期有效
$ wget -O jdk-8u131-linux-x64.tar.gz --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
自行判断校验码,不保证有效性和安全性
$ jdk_name=$(curl -s http://enos.itcollege.ee/~jpoial/allalaadimised/jdk8/ | grep tar.gz | grep -v demo |sed "s/.*href=/"//g;s//".*//g"|head -n 1) $ wget -O "$jdk_name" "http://enos.itcollege.ee/~jpoial/allalaadimised/jdk8/$jdk_name"
长期有效,不保证安全性
Download Java SE Standard Compliant Liberica JDK 8u222
$ wget -O bellsoft-jdk8u222-linux-amd64.tar.gz "https://download.bell-sw.com/java/8u222/bellsoft-jdk8u222-linux-amd64.tar.gz"
方法长期有效,但是AuthParam有时效性,无法写成脚本,也可以安装openjdk
wget -O ``jdk-8u221-linux-x64.tar.gz`` --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "``https://download.oracle.com/otn/java/jdk/8u221-b11/230deb18db3e4014bb8e3e8324f81b43/jdk-8u221-linux-x64.tar.gz?AuthParam=xxxxx_xxxxxxxxxxxxxxxxxx"