Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to decompile the jar package into Java source code for JD-GUI

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

How to decompile the jar package into Java source code for JD-GUI, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Programmers will inevitably learn from the code of other java projects. But sometimes you can only get .calss files, jar packages or war packages, which requires programmers to be adept at decompiling these types of files into Java code and forming a project that can be compiled and run. The decompiler introduced in this article is JD-GUI. The decompiled jar package is the jar package of a springboot project.

Download address https://pan.baidu.com/s/1zomK-U1eBN2_Z4wqscUvwA

Extraction code g8v8

Unzip it after download without installation. Double-click to open the exe file.

Open file selects the jar package to decompile

Open it and the java source code file is located in the classes- > com directory on the left.

Click on the file you want to view, you can see the source code, click on the underlined variable symbol, it will automatically jump to the definition, you can also search for the variable name, but the search will be slow, need to wait a little longer.

In this way, you can only view the code. In order to compile and modify the running code, you have to extract all the code to form an engineering project. Click File- > save all source

The source code will be saved as a compressed package

The compressed package is decompressed into three folders.

The java code is all in BOOT-INF/calsses/com.

Copy everything in the classes directory into the established empty springboot project to compile and run, and copy the directory level correctly. Copy the contents in application.properties and pom.xm and decompress the contents of the directory with the same name and paste them into the corresponding file of the springboot project.

Now you have the project code and the configuration file, but you can't run the project successfully. Because decompiled pom is not very accurate, there may be no import in pom for packages that many projects need. Or some of the jar packages used in the original project are imported into the project manually and are not managed by pom.

The best way is to extract all the jar packages that require import from the decompiled jar package.

Change the test01.jar suffix name to zip test01.zip and extract it to the current folder.

The unzipped BOOT-INF\ lib contains all the jar packages needed for the project, and all jar packages are added to the project by add external jar.

It is very close to running the project successfully, because the decompiled code is not particularly accurate, and some code needs to be manually analyzed and modified, or if the modification is not successful, it can only be commented out before it can be compiled. Some packages may report errors at run time, mainly because the package introduced by pom conflicts with the manually imported package, or some packages have the wrong version, which need to be resolved one by one. Of course, it is best that some decompilation projects run directly and correctly without reporting errors.

This is the answer to the question about how to decompile the jar package into Java source code for JD-GUI. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report