开发者

Extract directory from jar file

开发者 https://www.devze.com 2023-04-08 19:13 出处:网络
I have searched for this for a while now, but cant seem to figure it out. I want to extract a directory from a jar/zip file, and save it recursively to a path on the filesystem in java. Any开发者_JS百

I have searched for this for a while now, but cant seem to figure it out. I want to extract a directory from a jar/zip file, and save it recursively to a path on the filesystem in java. Any开发者_JS百科one know how I might do this?


An answer from this thread might give a good feeling how/where to start:

  • How to extract Java resources from JAR and zip archive

Simply put, it's java.util.jar you're looking for.


I know that the original question was actualy doing this programmatically.

But as it wasn't clear enough I guess many users (like me) ends up here when they just want to unzip a directory out of the jar using the jar command.

jar -xvf   <your>.jar  <required-dir>

E.g. extract META-INF directory out of some.jar

jar -xvf   some.jar  META-INF

to list the content of the jar use

jar -tvf   some.jar  
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号