2014-10-29 51 views
0

我第一次嘗試通過 Java的罐子test2.jar 運行我的jar文件,並得到了以下錯誤 「未能從test2.jar加載主類將Manifest屬性」當我運行我的jar文件沒有任何反應

谷歌搜索堆棧溢出後,我想出了一個解決方案,說我需要一個起始類nsme的manefest文件。
我嘗試以下

罐子立方英尺app.jar man.txt 現在沒有任何反應,當我鍵入光標剛剛進入到下一行 男子文件看起來像 主類行:CSTART

我CSTART看起來像

public class cStart { 
    public static void main (String[] args) { 
     Scanner scanner = new Scanner(System.in); 

     cRiunTest test; 
     test=new cRiunTest(); 
     test.run(); 

     if (true) 
      return; 
    } 
} 
+1

那'cRiunTest'是? – chrylis 2014-10-29 21:56:48

回答

0

jar命令是操縱JAR(Java歸檔)文件。要運行一個jar,你應該使用命令java -jar program.jar

+0

我做到了這一點,並得到以下錯誤「無法加載 test2.jar的主類清單屬性」 – 2014-10-29 23:03:55

+0

我使用NetBeans並自動爲項目創建清單。我認爲任何IDE都應該這樣做。嘗試瀏覽任何以下鏈接,看看是否有東西出現:http://stackoverflow.com/questions/9689793/cant-execute-jar-file-no-main-manifest-attribute – 2014-10-30 14:01:29

+0

或http://stackoverflow.com/questions/5507184/created-a-jar-file-get-could-not-find-main-class-even-with-manifest-txt-wi – 2014-10-30 14:02:27

相關問題