這些正是創建可執行jar文件的步驟,以便我可以通過雙擊運行我的swing程序,但它給了我一個錯誤,說「無效或損壞的jar文件」 也試圖通過命令提示符執行它給了我相同的錯誤無法打開可執行jar文件
Step 1:create a .java file which contains my swing code
Step 2:compile the .java file to .class file
Step 3:create jar file using the command jar cf name.jar classname.class
Step 4:open jar file using winrar archiever and modify manifest file by adding Main-class:classname
Step 5:try to execute the jar file
但上述步驟不工作,我不明白爲什麼?
我想另一件事太
Step 1:create a .java file which contains my swing code
Step 2:compile the .java file to .class file
Step 3:create jar file using the command jar cf name classname.class
Step 4:open jar file using winrar archiever and modify manifest file by adding Main-class:classname
Step 5:try to execute the jar file.In this case i can open my file through command prompt but not by double clicking. I tried to select javaw option through Open with option but it doesn't give any ouput(not even error)
試着用'java -jar file.jar'運行它。 –
我試過,但它給出了同樣的錯誤「無效或損壞的jar文件」 – Bhushan