2010-06-28 144 views

回答

7

如果您想要直接運行JAR文件(java -jar program.jar),則必須在清單文件中設置Main-Class屬性。詳情請參閱http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html

否則,您需要在類路徑上設置JAR,然後告訴它要運行的類。 (java -cp program.jar class.with.main.method

+0

如何使用ANT爲您構建可執行文件.jar文件:http://www.vertigrated.com/blog/2009/11/how-to-bundle-command-line-programs-into- a-single-executable-jar-file/ – 2010-06-28 21:38:16

+0

http://www.petefreitag.com/item/24.cfm – nevets1219 2010-06-28 21:43:00