How can I replace a class file in jar files?

前端 未结 3 1717
盖世英雄少女心
盖世英雄少女心 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: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.

提交回复
热议问题