There is a jar file. It is necessary to decompile one of its classes, edit one value and compile it back.
1 answer
If you want to do this one time, then try JAD . But note that decompilers cannot always get the source from a .class file. Suppose you managed to decompile it correctly. After that, it must be collected back. To do this, you need to use the compiler.
javac -cp исходный.jar:библиотеки.jar исправленный.класс.java
(if under Windows, then libraries should be separated with a semicolon instead of a colon)
Well, and then pack with the utility jar or some winrar
If JAD does not produce a bad source, then you can try other options for decompilers. In the worst case, after decompiling, you will have to understand bytecode and use your hands to edit the wrong decompiled code.
UPD
It is also possible to open a .class file and edit it with Apache BCEL. With his help, you can load the class, modify it, and then write it back. True Apache BCEL is a software tool, not a tool, so you have to write a program that would patch the class as needed.
- I just need to change the string string from 12.jpg to 1.jpg. Can it be possible immediately through the byte code? - or8it
- Well, then open the HEX-editor and look at the desired line. It is a pity that you need to shorten the line: this complicates the task. - cy6erGn0m
- And after shortening the line, what to do to make the library working? - Anton Mukhin
- 2Isn't it easier to rename 1.jpg to 12.jpg and replace the files? - Gautama Buddha
- oneWell, apparently crookedly corrected. This is because it says that the UTF8 string is invalid. But in general, if you want to be sure that it works, then do it with the help of BCEL. Then, in any case, everything will turn out even if the line needs to be made longer. - cy6erGn0m