在文件夾~/code/
我有 bin/ src/ lib/
甲manifest.txt在〜/創建與所述內容:創建命令行可運行罐子
Main-class: test.MyMainClass
Class-Path: lib/*.jar
然後在〜我用命令
jar cfm d.jar manifest.txt code/
然後我運行
java -jar d.jar
它說
Exception in thread "main" java.lang.NoClassDefFoundError: test/MyMainClass Caused by: java.lang.ClassNotFoundException: test.MyMainClass
可能重複[Java:在命令行中運行jar文件的問題](http://stackoverflow.com/questions/945962/java-problem-running-a-jar-file-in-command-line ) – 2012-07-08 21:51:31