Modify any file in the jar package and repackage it into an executable jar file

background

        Without the project source code, the project cannot be started or the logic needs to be modified. Because without the source code, it is not so convenient to modify and repackage.

        The method used is to decompress the jar first, modify the file, and compress it into a jar package.

unzip jar

        Traditional compression tools, such as 360, Haoya, 7z, etc., can decompress files. Right click on the selected file and unzip it to the corresponding directory

 modify file

        If it is a text file such as a configuration file, open a text editor to modify and save it.

        If it is a class file that needs to be decompiled, modify the code and recompile it into a class. Note here that the jdk version used should be consistent with the previous class file. For example, if it was jdk1.8 before, the modified and compiled class file should also be 1.8

package jar file

        Enter the decompressed directory, and note that the lib package of the jar cannot be compressed. Repackage with the command

jar cvfm0 axis2-transport-http-1.7.7.jar axis2-transport-http-1.7.7\META-INF\MANIFEST.MF -C axis2-transport-http-1.7.7/ .

Note that the last / and . have spaces. The point is that 0 does not perform compression packaging 

Guess you like

Origin blog.csdn.net/u011471105/article/details/128335323
Recommended