当前位置:网站首页>反编译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文件直接拖进去即可。

边栏推荐
- Win10 add right-click menu for any file
- Semi supervised learning—— Π- Introduction to model, temporary assembling and mean teacher
- 有關二叉樹的一些練習題
- 最全H桥电机驱动模块L298N原理及应用
- 枚举?构造器?面试Demo
- Analysis of key technologies for live broadcast pain points -- second opening, clarity and fluency of the first frame
- Shortcut key bug, reproducible (it seems that bug is the required function [funny.Gif])
- [MySQL basic] general syntax 1
- 静态代码块Vs构造代码块
- Advanced mathematics Chapter 7 differential equations
猜你喜欢

Getting started with webrtc: 12 Rtendpoint and webrtcendpoint under kurento

1098 Insertion or Heap Sort(堆排序解释)(PAT甲级)

When multiple network devices exist, how to configure their Internet access priority?

Flow chart of Alipay wechat payment business

Advanced mathematics Chapter 7 differential equations

Matlab tips (19) matrix analysis -- principal component analysis

枚举?构造器?面试Demo

【mysql篇-基础篇】通用语法1
![[cloud native] 2.3 kubernetes core practice (Part 1)](/img/f8/dbd2546e775625d5c98881e7745047.png)
[cloud native] 2.3 kubernetes core practice (Part 1)

HiTek电源维修X光机高压发生器维修XR150-603-02
随机推荐
Rockermq message sending and consumption mode
巴基斯坦安全部队开展反恐行动 打死7名恐怖分子
有关二叉树的一些练习题
借助原子变量,使用CAS完成并发操作
I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!
ThreadLocal digs its knowledge points again
Introduction to websocket protocol
The markdown plug-in of the browser cannot display the picture
Rough reading DS transunet: dual swing transformer u-net for medical image segmentation
枚举?构造器?面试Demo
std::memory_order_seq_cst内存序
Nosql 数据库 -Redis 安装
Demand visual Engineer
经典的一道面试题,涵盖4个热点知识
Preliminary understanding of pytorch
Analysis of key technologies for live broadcast pain points -- second opening, clarity and fluency of the first frame
Tips for using Jupiter notebook
There is no doubt that this is an absolutely elaborate project
1098 Insertion or Heap Sort(堆排序解释)(PAT甲级)
了解神经网络结构和优化方法