So, I have third party library, which is a .jar file. There are some classes in that jar. The problem is, there is one bug in one class in that .jar. I know it because I can decompile the jar file, to look at the java code, which is I am pretty sure, that class is the source of my program bug.
The idea is, I delete the class and replace it with my own class, but I dont know how.
one more approach using winzip/winrar open your jar, go to the class location and just drag and drop updated class, close winrar/winzip and do not need to explod jar and then recrete jar...
Before opening jar file just change the extension of jar to zip file and then extract that particular class file that you want to edit , then decompile it using any decompiler ,make the changes , compile it back and then finally put it back in the zip file. Hope it helps.
There are multiple ways to do this:
Try to use winrar. You can open your jar in it, explore the directory containing the class file. You can delete and add class files.
If you don't want to use winrar then do like this:
Extract the jar using this command
jar -xvf yourjar.jar
It will explode the jar. Delete the old class file and add your updated class file
Recreate the jar using the following command
jar -cvf yourjar.jar directoryofexploderjar/
Extend class and rewrite method removing bug
Use JDEC to decompile and replace class ( http://jdec.sourceforge.net/ )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With