1:最近买了一个阿里云服务器,需要安装jdk,然后呢,我就在百度搜到一篇用wget命令获取jdk的文章,连接如下:
http://jingyan.baidu.com/article/0aa2237555d0c488cc0d6438.html
按照它的方式:输入下面的命令,的确可以下载jdk
wget http://download:oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz
2:然后按照它写的方式,将下载下来的jdk解压报错,报错信息如下:
[root@iZrj9bmsq801kry9n332hiZ ~]# tar xf jdk-8u60-linux-x64.tar.gz -C /usr/local/
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
[root@iZrj9bmsq801kry9n332hiZ ~]#
3:原因是:
The reason the file isn't extracting properly is because thedownload pageis setting a cookie when you accept the license agreement. If you don't have the session cookie when attempting to download the file,it redirects you to an HTML page that tells you to accept the agreement first. If you open the .tar.gz that you're getting fromwget
,you'll see that it's an HTML file since it's not getting said cookie.
The easiest way to solve it is to download the file first,using your web browser,and then upload it to your web server.
上面的英文大致意思是:在Oracle官网下载jdk的时候,有个同意安装协议,但是用wget的方式,默认是不同意,所以没法解压:
4:奉献上网页上下载jdk的截图,可以看到有个同意协议的单选按钮,默认是不同意。
5:问题解决办法
从官网网页上下载jdk包,用xftp等ftp工具将jdk上传到阿里云服务器。