Mac OS X上的Jar文件

时间:2021-10-24 16:44:27

I have a jar file that is used by a Java program. It has all the preferences and stuff (it's not an executable). I used archive utility to uncompress it and i edited the files. Now I need to put them back in the jar the same way so the Java program can use it again. How can I do that? Thanks.

我有一个Java程序使用的jar文件。它具有所有首选项和内容(它不是可执行文件)。我使用归档实用程序解压缩它,我编辑了文件。现在我需要以相同的方式将它们放回到jar中,以便Java程序可以再次使用它。我怎样才能做到这一点?谢谢。

1 个解决方案

#1


0  

The command-line jar utility has its own man page (man jar at the Terminal prompt to see it.) You will have to make sure to tell it about the MANIFEST.MF file, if any, so it gets handled correctly.

命令行jar实用程序有自己的手册页(在终端提示符下查看man man。)你必须确保告诉它有关MANIFEST.MF文件(如果有的话),以便正确处理它。

Alternatively, jar files are just (usually uncompressed) PKZIP files, and Mac OS X comes with a zip client. Just something like this would be fine:

或者,jar文件只是(通常是未压缩的)PKZIP文件,而Mac OS X附带一个zip客户端。这样的事情就好了:

zip -r0 filename.jar dir1 dir2 dir3

where dir1, dir2, dir3 are the directories you want to be zipped up and appear at the top level of the jar file.

其中dir1,dir2,dir3是您想要压缩并出现在jar文件顶层的目录。

#1


0  

The command-line jar utility has its own man page (man jar at the Terminal prompt to see it.) You will have to make sure to tell it about the MANIFEST.MF file, if any, so it gets handled correctly.

命令行jar实用程序有自己的手册页(在终端提示符下查看man man。)你必须确保告诉它有关MANIFEST.MF文件(如果有的话),以便正确处理它。

Alternatively, jar files are just (usually uncompressed) PKZIP files, and Mac OS X comes with a zip client. Just something like this would be fine:

或者,jar文件只是(通常是未压缩的)PKZIP文件,而Mac OS X附带一个zip客户端。这样的事情就好了:

zip -r0 filename.jar dir1 dir2 dir3

where dir1, dir2, dir3 are the directories you want to be zipped up and appear at the top level of the jar file.

其中dir1,dir2,dir3是您想要压缩并出现在jar文件顶层的目录。