How can I replace a class file in jar files?

前端 未结 3 1718
盖世英雄少女心
盖世英雄少女心 2021-01-07 10:10

A coworker of mine wrote a class. His class uses my class. Rather than tell the JVM where my class lives every time his class is compiled, he packaged both classes into a ja

相关标签:
3条回答
  • 2021-01-07 10:35

    You can extract your .jar file and change your compiled classes.

    0 讨论(0)
  • 2021-01-07 10:39

    Im not sure if you can get away with it or not, but you might want to just try compiling your class to a jar file, then opening his jar file up in some compression agent like WinRAR, and simply overwriting the old jar file contained in his jar file with your newly compiled version. A better way (if he class isnt obfuscated) would be to open his jar file in a Java IDE, and create a new project from it. Then reference the the project you created from his jar file in your project in the same IDE. This way, you can make changes to both in the same environment, and compiling the code after changes will be easier.

    0 讨论(0)
  • 2021-01-07 10:51

    In Eclipse i think it should be enough to export your code as jar file.

    http://viralpatel.net/blogs/create-jar-file-in-java-eclipse/

    So basically you get the old jar, extract, load as project in eclipse and export as jar file. And you're done.

    0 讨论(0)
提交回复
热议问题