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

后端 未结 4 1291
时光说笑
时光说笑 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:19

    1. Open Command Prompt
    2. cd go to the path where jar file exist
    3. run command jar xf fileName.jar
    4. It will generate com, META-INF & Copyright.mk files
    5. Go to the particular package where u want to modify the class file (Basically class files present in com directory)
    6. Download the JAD.exe from google (Its Zip File)
    7. Extract the Zip file you will get jad.exe
    8. Place the class file (which u want to modify) in the folder, that contains jad.exe
    9. Go to command prompt, run jad fileName.class (the class filename which u want to modify)
    10. fileName.jad file will get generate , rename it as fileName.java
    11. compile the fileName.java (if its referring to some other class file configure it in eclipse accordingly)
    12. once compiled replace the class file in the directory defined in step 4
    13. Go to command prompt, cd Step 4 path, run jar cf fileName.jar (* represents all the class files irrespective of directories)

提交回复
热议问题