创建一个jar文件 - 保留文件权限 [英] creating a jar file - preserving file permissions
问题描述
我想知道如何创建一个保存其内容文件权限的jar文件。
I would like to know how to create a jar file that preserves the file permissions of its content.
我在jar文件中打包源代码和可执行文件将在使用前提取。人们应该能够通过运行批处理/ shell脚本文件立即运行示例和演示。然后他们应该能够修改源代码并重新编译所有内容。
I'm packaging up source and executables in a jar file that will be extracted before use. People should be able to immediately run the examples and demonstrations by running batch / shell script files. Then they should be able to modify source and re-compile everything.
我正在努力让使用它的人生活轻松,这包括那些不熟悉的人可能在Linux / Unix上工作的Java和编程。
I'm trying to make life easy for people who use it and this includes people who are new to Java and programming who might be working on Linux / Unix.
我可以访问运行Windows和Linux的机器。我不经常使用Linux,所以也许我做错了。
I have access to machines running Windows and Linux. I don't use Linux a lot so maybe I've done something wrong.
我在设置权限后使用jar cf ....在Linux上创建了一个jar文件文件,以便一切按需工作。然后我创建了一个新的测试目录并将jar文件内容解压缩到其中。文件权限未被保留...即-rw-rw-r--
I created a jar file on Linux using jar cf .... after setting permissions on the files so that everything worked as needed. Then I created a new test directory and extracted the jar file contents into it. The file permissions were not preserved ... i.e. -rw-rw-r--
推荐答案
jar
工具不存储文件权限,因此无法恢复尚未存储的内容。 jar
格式不是为了将文件和元数据存档为 zip
或 tar
,它是一个为应用程序嵌入java文件的简单容器。
The jar
tool doesn't store file permissions, so you can't recover what has not been stored. jar
format is not intended to archive files and metadata as zip
or tar
, it is a simple container to embed java files for an application.
这篇关于创建一个jar文件 - 保留文件权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!