Do you really need to unpack the entire jar and recompile everything? Instead of recompiling the entire decompiled source yourself, use the source jar as the classpath and extract and recompile only the classes you need to change. Then, when you need to pack your recompiled code, just copy the source jar and use jar -uf to replace the modified class files in place:
jar -uf ./lib/copy_of_original_jar_file.jar -C ./bin com/foo/A.class com/foo/B.class [...]
... and. / lib / copy _of_original_jar_file.jar becomes your new library.
One thing is certain, and this means that the original jar must work correctly with the Java class loader for the program to start. It should work the same as compiling your classmate .class files.
You should have much less name conflict problems using the original jar because you keep the same class pool scan order as the running application. Not only that, but Java decompilers are not perfect. By eliminating the need to recompile most of the decompiled codes, you avoid most of the problems that decompilers have with similar overlays of exception handlers, special characters in obfuscated characters, problems with variable visibility, etc.
source share