开发者

edit java class file JAD

开发者 https://www.devze.com 2023-01-02 16:25 出处:网络
i ne开发者_C百科ed to change the access modifier of one constructor in a class file... how do i do it with jad..

i ne开发者_C百科ed to change the access modifier of one constructor in a class file... how do i do it with jad..

thanks all...

raj...


Solution with JAD:

  1. Decompile the class with JAD
  2. Edit it with your favorite editor
  3. Save the file
  4. Compile it with javac

More simple solution:

Class<?> c = Class.forName("fully.qualified.name.of.your.Class");
ctor = c.getConstructor(...argument types here...);
ctor.setAccessible(true);

(Your IDE will suggest the type for ctor ... otherwise change it)

Now you can invoke the constructor at runtime.

If you really need to modify the byte code, have a look at the ASM library.

0

精彩评论

暂无评论...
验证码 换一张
取 消