且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

线程“主”中的异常java.lang.NullPointerException:尝试运行jar文件时

更新时间:2023-11-09 23:34:46

添加jar不足以将其包含在文件中,您需要我们e m 选项,如

To add the jar is not enough to include it in the files, you have to use the m option, like

jar cmf myManifestFile myFile.jar *.class

根据 jar文档。选项 m f 的顺序必须匹配 MANIFEST 文件和jar文件。

according to jar documentation. The order of the options m and f has to match the order of the parameters for the name of the MANIFEST file and the jar file.

也考虑到这个警告:现有的清单文件必须以新行字符。如果不以新的行字符结尾,则jar不解析清单文件的最后一行。