通过代码从当前运行的JAR中提取文件 [英] Extracting a file from the currently running JAR through code

查看:111
本文介绍了通过代码从当前运行的JAR中提取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是否可以使用任何内置方法来允许用户从当前运行的JAR中提取文件并将其保存在磁盘上?

Are there any built-in methods I can use to allow users to extract a file from the currently running JAR and save it on their disk?

提前致谢。

推荐答案

使用 getResourceAsStream (docs),你可以做无论你想要什么,在那之后。

Use getResourceAsStream (docs), you can do whatever you want with it after that.

对于双线班车你可以使用 Commons IO复制方法之一

For a two-liner you could use one of the Commons IO copy methods.

这篇关于通过代码从当前运行的JAR中提取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆