如何使用我創建的「manifest.mf」文件創建應包含2個文件「.class」(命名爲MyFirstClass.class和MySecondClass.class)的存檔「classes.jar」。如何使用cmd創建jar文件?
這必須使用程序javac,程序jar和cmd完成。
2個文件.class我已經使用了javac程序。
這是所有存放在目錄C:\ Task7位於在目錄C
MyFirstClass.class文件:\ Task7 \ mypackage的(因爲它是在包 「mypackage的」)
MySecondClass。位於文件夾C類文件:\ Task7 \ mypackage中\ myfirstpackage(因爲它是在mypackage的包和myfirstpackage)位於文件夾C
myManifest.mf文件:\ Task7
我嘗試:
1)C:\ Program Files文件\的Java \ jdk1.7.0_51 \ BIN>罐子CVFM classes.jar C:\ Task7清單-CC:\ Task7 myPackage.MyFirstClass.class myPackage.myfirstpackage.MySecondClass.class
CMD答案:
java.io.FileNotFoundException: C:\Task7 (Mbp4p3m r •meCesix)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at sun.tools.jar.Main.run(Main.java:171)
at sun.tools.jar.Main.main(Main.java:1177)
2)C:\ Program Files文件\的Java \ jdk1.7.0_51 \ BIN>罐子CVFM classes.jar C:\ Task7清單C:\ Task7 \ mypackage中\ MyFirstClass.class C: \ Task7 \ myPackage \ myfirstpackage \ MySecondClass.class
cmd回答:
java.io.FileNotFoundException: C:\Task7 (Mbp4p3m r omeCesix)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at sun.tools.jar.Main.run(Main.java:171)
at sun.tools.jar.Main.main(Main.java:1177)
3)C:\ Program Files \ Java \ jdk1.7.0_51 \ bin> jar cvfm classes.jar C:\ Task7清單C:\ Task7 \ myPackage MyFirstClass.class C:\ Task7 \ myPackage \ myfirstpackage MySecondClass的.class
CMD答案:
java.io.FileNotFoundException: C:\Task7 (Cbpgrosm r omeCegx)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at sun.tools.jar.Main.run(Main.java:171)
at sun.tools.jar.Main.main(Main.java:1177)
我在做什麼錯?
'jar -c' - 添加減號 – gaborsch 2014-09-23 12:49:15
請不要發佈(鏈接到)圖片的文字,發佈文字本身。 – 2014-09-23 12:55:14