运行java [-options] -jar jarfile(没有给出明确的类名)

Yan*_*eve 2 java jar

如果我错了,请纠正我.

java [-options] -jar jarfile没有显式类名运行时,如果包含public static void main(String[] args)方法的jar中存在单个类,则将自动调用该方法.对?

如果我有几个包含合格main方法的类会怎样?

dig*_*oel 6

它使用MANIFEST文件中定义的Main-Class来确定哪个类包含应该运行的main方法.

请参阅http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html