1

i need to change the access modifier of one constructor in a class file... how do i do it with jad..

thanks all...

raj...

1
  • 1
    JAD is a decompiler, not a classfile modification tool. Commented Jun 9, 2010 at 11:48

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Aaron, it would be so helpul of you, if yu can provide a snippet where i can make the private constructor taking no arguments accessible... i am nt able to get the proper paramater list thanks...
This article should help to get you started with reflection: java.sun.com/developer/technicalArticles/ALT/Reflection

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.