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

边栏推荐
- Video file too large? Use ffmpeg to compress it losslessly
- 2022.06.26 (LC Luo 6101 Luo determines whether the matrix is an X matrix)
- The largest rectangle in the bar graph of force buckle 84
- js中的数组对象
- Improving efficiency or increasing costs, how should developers understand pair programming?
- vector::data() 指针使用细节
- 集合框架 泛型LinkedList TreeSet
- Imx8qxp DMA resources and usage (unfinished)
- openpyxl表格读取实例
- std::memory_ order_ seq_ CST memory order
猜你喜欢

Markem Imaje Marken IMAS printer maintenance 9450e printer maintenance

Rockermq message sending and consumption mode

One week's experience of using Obsidian (configuration, theme and plug-in)

微信小程序学习之五种页面跳转方法.

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

A classic interview question covering 4 hot topics

C# 解决使用SQLite 的相对路径问题

DV scroll board width of datav rotation table component

Hitek power supply maintenance X-ray machine high voltage generator maintenance xr150-603-02

力扣84柱状图中最大的矩形
随机推荐
Advanced mathematics Chapter 7 differential equations
C# 解决使用SQLite 的相对路径问题
强化学习中好奇心机制
How do I get the STW (pause) time of a GC (garbage collector)?
Source insight 工具安装及使用方法
[ 扩散模型(Diffusion Model) ]
Conception de plusieurs classes
JS 文件上传下载
Principle and application of the most complete H-bridge motor drive module L298N
I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!
Analysis of orthofinder lineal homologous proteins and result processing
Today's three interviews demo[integer ASCII class relationship]
There is no doubt that this is an absolutely elaborate project
0号进程,1号进程,2号进程
我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
Several cases that do not initialize classes
更改pip镜像源
Prometheus alarm process and related time parameter description
Semi-supervised Learning入门学习——Π-Model、Temporal Ensembling、Mean Teacher简介
枚举?构造器?面试Demo