这些正是创建可执行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