(JAVA) Use Command Prompt to create .jar file from multiple .class files

后端 未结 4 1289
时光说笑
时光说笑 2021-01-11 23:00

I have written a .java file, called Main.java, and have compiled it using the javac in the Windows Command Prompt. The compiler is creating multiple .class files (called Mai

4条回答
  •  一整个雨季
    2021-01-11 23:35

    You need to use the entry-point switch -e (with the name of the class containing the main() method) as such:

    jar cfve file.jar Main Main.class Main$1.class Main$2.class
    

提交回复
热议问题