由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 没有源代码,想替换掉一个class文件里的类
相关主题
看了zhaoce073大水忍不住说2句怎麼得到字符串中的raw bytes?
What do you think about AOP?spring transaction的问题
问个很简单的问题?How to parse the bytes[]
help about bitstream writerAspectJ question
aspectJ QuestionaspectJ question
有多少人对annotation这个东西不满,请举手!!aspectJ question
怎样吧byte[]变成java.security.Key?another aspectJ question
interestingaspectJ + ant , how to define task?
相关话题的讨论汇总
话题: class话题: 源代码话题: substitue话题: 换掉话题: license
进入Java版参与讨论
1 (共1页)
d******e
发帖数: 117
1
手头有一个大的java程序,没有它的源代码。这个程序里有一个类,我想改变它的几个
method的功能, 就开发了一个新的类,interface保持相同. 我能不能在这个程序运行
时,让这个新的类自动替换掉旧的类?
s***8
发帖数: 1136
2
If the client code is programmed to the interface, and acquire the reference
via injection or lookup, you can tweak the configuration the provide your
impl. If it's direct instantiation, this option won't work.
Then you can try attach a java agent and in its pre-main method enhance the byte code and substitue it.
r*****l
发帖数: 2859
3
Can also try AspectJ.

reference
the byte code and substitue it.

【在 s***8 的大作中提到】
: If the client code is programmed to the interface, and acquire the reference
: via injection or lookup, you can tweak the configuration the provide your
: impl. If it's direct instantiation, this option won't work.
: Then you can try attach a java agent and in its pre-main method enhance the byte code and substitue it.

g*****g
发帖数: 34805
4
Well, if you are sure there's no license issue. Just remove the
class, have your class in the right package, compiled, put it back in the
jar.

【在 d******e 的大作中提到】
: 手头有一个大的java程序,没有它的源代码。这个程序里有一个类,我想改变它的几个
: method的功能, 就开发了一个新的类,interface保持相同. 我能不能在这个程序运行
: 时,让这个新的类自动替换掉旧的类?

e*****t
发帖数: 1005
5
yeah, definitely check the license and talk to somebody who deals with
license in your organization to make sure it own't bite you later.
What goodbug said is the simplest solution. If you in control of the
classpath, you may also try to put your class on the classpath before this
jar.

【在 g*****g 的大作中提到】
: Well, if you are sure there's no license issue. Just remove the
: class, have your class in the right package, compiled, put it back in the
: jar.

k******p
发帖数: 21
6
decompile and customize/subclass it
1 (共1页)
进入Java版参与讨论
相关主题
aspectJ + ant , how to define task?aspectJ Question
看Spring真是头大有多少人对annotation这个东西不满,请举手!!
How to intercept a method call怎样吧byte[]变成java.security.Key?
spring AOP questioninteresting
看了zhaoce073大水忍不住说2句怎麼得到字符串中的raw bytes?
What do you think about AOP?spring transaction的问题
问个很简单的问题?How to parse the bytes[]
help about bitstream writerAspectJ question
相关话题的讨论汇总
话题: class话题: 源代码话题: substitue话题: 换掉话题: license