前几天去阿里云买了学生特权的云服务器。
现在下载JDK的时候遇到了麻烦,
输入命令:
wget http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm
下载下来后,文件大小是8K…8K…
后来想到,应该是做了什么防护吧,监控网络,发现有cookie防护。
于是把命令改成:
wget -c -P /java/jdk --no-check-certificate --no-cookie --header "Cookie: s_nr=1479818001999; s_cc=true; s_sq=oracledevall%3D%2526pid%253Docom%25253Aen-us%25253A%25252Fcn%25252Fjava%25252Fjavase%25252Foverview%25252F%2526pidt%253D1%2526oid%253Dotn%25253Acn%25253Atab%25253Ajava%25253A%2525E4%2525B8%25258B%2525E8%2525BD%2525BD%2526oidt%253D1%2526ot%253DA%2526oi%253D1; ELOQUA=GUID=4b703a6e148b4855a6708de929b383a5; gpw_e24=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fcn%2Fjava%2Fjavase%2Fdownloads%2Fjdk7-downloads-1880260.html; oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm
成功下载:
这个下载到的目录是 /java/jdk 目录
还有一个短一点的代码,也可以:
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm
这个下载到的目录是当前目录!
OK,希望大家解决了linux下载jdk问题。