简体   繁体   English

Mac OS X上的jar文件

[英]Jar file on Mac OS X

I have a jar file that is used by a Java program. 我有一个Java程序使用的jar文件。 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. 现在,我需要以相同的方式将它们放回jar中,以便Java程序可以再次使用它。 How can I do that? 我怎样才能做到这一点? Thanks. 谢谢。

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 jar上可以看到它。)您必须确保将MANIFEST.MF文件(如果有的话)告诉它,以便正确处理它。

Alternatively, jar files are just (usually uncompressed) PKZIP files, and Mac OS X comes with a zip client. 另外,jar文件只是(通常是未压缩的)PKZIP文件,而Mac OS X带有zip客户端。 Just something like this would be fine: 像这样的事情就可以了:

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文件的顶层。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM