我想问一个问题,是否有将文件(即图像)复制到 .jar 文件的方法,因为我想部署一个程序并创建了文件夹源代码(它们与源代码位于同一位置)和文件夹在 jar 文件中(我使用 Netbeans 创建 jar 文件)......现在我想要的是我想将 JFileChooser 选择的文件复制到 jar 文件中的文件夹???? 任何想法都被衷心接受..!!!提前致谢????
附言: 我已经尝试在网上搜索答案,但他们只知道如何将 jar 文件中的文件复制到另一个目录......
最佳答案
假设您要将文件 images/image1.gif 添加到 JAR 文件中。
jar uf <fileName>.jar images/image1.gif
改变目录使用-c
jar uf <fileName>.jar -C
在这个命令中
jar uf jar-file 输入文件
在这个命令中:
The u option indicates that you want to update an existing JAR file.
The f option indicates that the JAR file to update is specified on the command line.
jar-file is the existing JAR file that's to be updated.
input-file(s) is a space-delimited list of one or more files that you want to add to the Jar file.
关于java - 有没有办法将文件复制到 jar 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24060272/