我使用命令jar cmf <text-file-points-to-main-class> <archive-name.jar>
爲可執行jar文件產生的結果而創建可執行的JAR文件執行jar文件,但是當我試圖打開使用java -jar file-name.jar
以下例外是可執行的jar升高不能從CMD
Exception in thread "main" java.lang.NullPointerException
at sun.launcher.LauncherHelper.getMainClassFromJar(LauncherHelper.java:399)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:463)
<text-file-points-to-main-class>
其實包含---> Main-Class:hello.java我也試過了(你好沒有.java) 我不能指出究竟是什麼問題?注意,類文件正常工作
請發表您的清單文件的確切內容。 –
有很多關於此的帖子,沒有人真的幫助過嗎? http://stackoverflow.com/questions/7368349/nullpointerexception-when-trying-to-run-jar-file http://stackoverflow.com/questions/8192647/failing-to-execute-the-jar-file-using -java-jar-command http://stackoverflow.com/questions/9287997/exception-in-thread-main-java-lang-nulpointerexception-while-trying-to-the – MrLore