Unjar to a specific destination

a 夏天 提交于 2019-12-21 03:57:24

问题


Is there a way to extract a jar file to a specific directory? For instance, I'm in foo directory, which contains the subfolder bar; all my jars files are at the same level at bar. So I passed the command jar xf my.jar -C bar/ However when I went to bar folder, the files were not extracted. Is there a way for me to do it without having to move the jar file to bar?

Thanks


回答1:


I don't think jar supports this, but unzip does. Try:

unzip my.jar -d bar

The behaviour is the same as the jar command, because jar files are the same as zip files.




回答2:


"Is there a way for me to do it without having to move the jar file to bar?"

You can do this by entering bar and executing the extract command from there, like this:

cd bar
jar xf ../my.jar


来源:https://stackoverflow.com/questions/8970432/unjar-to-a-specific-destination

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