Issues uncompressing a tar.gz file

独自空忆成欢 提交于 2019-12-03 15:42:01

问题


I have been trying to uncompress the following file:

sudo wget http://download.oracle.com/otn-pub/java/jdk/7u21-b11/jdk-7u21-linux-x64.tar.gz

with the following:

sudo tar zxvf jdk-7u21-linux-x64.tar.gz -C /usr/lib/jvm/

I am getting this error

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

I am using an Amazon Linux instances. By default jre is installed instead of the jdk, which I need to be able to run jboss. I would install the jdk using yum, but unfortunately it doesn't seem to be possible. Issue I am having is that it doesn't make sense why its not working if I am doing everything right from what I have been able to discern. I have downloaded two different versions just to be sure its not just corrupted files. Any help figuring this out would be greatly appreciated!


回答1:


The reason the file isn't extracting properly is because the download page is 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 from wget, 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.




回答2:


I know this thread is old, but I figured someone might be able to use this information when searching the web for why they can't unzip their JDK distros on raspberrypi

If you pass these parameters to wget it will also accept the policy.

--no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"



回答3:


j883376 answer is right.But The easiest way to solve it is to download the file first, using your web browser, and then copy the download url then wget it useing your server.



来源:https://stackoverflow.com/questions/16381917/issues-uncompressing-a-tar-gz-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!