当前位置:网站首页>反编译jar包,修改后重新编译为jar包
反编译jar包,修改后重新编译为jar包
2022-06-27 09:25:00 【lgq2016】
使用开源jar包或者供应商jar包时,会发现一些bug或者已有功能无法满足我们要求,需要对jar中的.class文件进行修改。处理步骤如下所示:
1.使用反编译工具将jar包反编译为源文件
反编译工具请参考XJAD2.2版下载地址:http://www.blogjava.net/Files/96sd2/XJad2.2.rar
如果只是少量的几个class需要修改,可以直接用IDEA或者jd-gui工具打开,将.class文件中的内容直接复制并创建同名的.java文件(需要根据jar包中建立所有的上层目录,比如com.athome.cas.Test.java,需要创建com.athome.cas等目录,将Test.java放在目录下面)
2.修改java文件
对源文件.java进行编写并测试功能
3.编译整个jar包或特定的几个java文件
用IDEA打开整个源文件,使用bulid编译文件或者整个项目(可以选中单独java文件编译为.class)

4.编译报错时的处理
编译报错最常见的就是下面这种例子:
Util.java:9: 错误: 程序包javax.servlet不存在
import javax.servlet.ServletException
需要导入对应的依赖,我们可以在pom.xml文件中加入pom依赖,需要的包可以在仓库查询
如果是单独几个.class文件可以直接用压缩文件打开原来的jar包,将修改后编译生成的class文件直接拖进去即可。

边栏推荐
- That is, a one-stop live broadcast service with "smooth live broadcast" and full link upgrade
- A classic interview question covering 4 hot topics
- Imx8qxp DMA resources and usage (unfinished)
- 巴基斯坦安全部队开展反恐行动 打死7名恐怖分子
- 多个类的设计
- Prometheus alarm process and related time parameter description
- Quelques exercices sur les arbres binaires
- 多個類的設計
- Object含有Copy方法?
- Fake constructor???
猜你喜欢

Five page Jump methods for wechat applet learning

Analysis of orthofinder lineal homologous proteins and result processing
Scientists develop two new methods to provide stronger security protection for intelligent devices

Markem imaje马肯依玛士喷码机维修9450E打码机维修

Installation and use of SVN version controller

枚举?构造器?面试Demo

Principle and application of the most complete H-bridge motor drive module L298N
![文件名设置导致writelines写入报错:OSError: [Errno 22] Invalid argument](/img/08/2d4f425e6941af35616911672b6fed.png)
文件名设置导致writelines写入报错:OSError: [Errno 22] Invalid argument

1098 insertion or heap sort (PAT class a)

Rockermq message sending and consumption mode
随机推荐
Tips for using Jupiter notebook
Installation and usage of source insight tool
高等数学第七章微分方程
【生动理解】深度学习中常用的各项评价指标含义TP、FP、TN、FN、IoU、Accuracy
多个类的设计
Win10 add right-click menu for any file
E+H二次表维修PH变送器二次显示仪修理CPM253-MR0005
快捷键 bug,可复现(貌似 bug 才是需要的功能 [滑稽.gif])
Some exercises about binary tree
1098 insertion or heap sort (PAT class a)
内存泄露的最直接表现
How Oracle converts strings to multiple lines
Vector:: data() pointer usage details
C# 解决使用SQLite 的相对路径问题
Prometheus alarm process and related time parameter description
静态代码块Vs构造代码块
Collection framework generic LinkedList TreeSet
使线程释放锁资源的操作/方法重载一点注意事项
When multiple network devices exist, how to configure their Internet access priority?
队列,双向队列,及其运用