我认为@Jon 是正确的,只要确保以 CR/LF 结束文件即可。
设置应用程序的入口点
警告:文本文件必须以换行符或回车符结尾。如果最后一行没有以新行或回车结束,则不会正确解析。
或者你可以让 jar 程序自动为你创建 Main-Class 属性。
The 'e' flag (for 'entrypoint'),
introduced in JDK 6, creates or
overrides the manifest's Main-Class
attribute. It can be used while
creating or updating a jar file. Use
it to specify the application entry
point without editing or creating the
manifest file. For example, this
command creates app.jar where the
Main-Class attribute value in the
manifest is set to MyApp:
jar cfe app.jar MyApp MyApp.class
You can directly invoke this
application by running the following
command:
java -jar app.jar
If the entrypoint class name is in a
package it may use a '.' (dot)
character as the delimiter. For
example, if Main.class is in a package
called foo the entry point can be
specified in the following ways:
jar cfe Main.jar foo.Main foo/Main.class