*
The moose likes Beginning Java and the fly likes Reflection Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Reflection Problem" Watch "Reflection Problem" New topic
Author

Reflection Problem

V Vijay Veeraraghavan
Greenhorn

Joined: Apr 06, 2008
Posts: 21
----------------------------------

dear all
i am using reflection to invoke particular methods to fetch the values from them. i have a class structure like this


//the above code works for all the methods... but for getValue and setValue exception is thrown....
java.lang.IllegalAccessException: Class MyClass can not access a member of class MyPackage.C with modifiers "public"

i am able to understand that the problem is with the protected package which i try to access from outside. but how do i solve this problem roundabout way...

thanks

Vijay Veeraraghavan

----------------------------------

[Nitesh: Added code tags: Please UseCodeTags]
[ November 24, 2008: Message edited by: Nitesh Kant ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Not really an advanced question. Have a read of the JavaDocs for java.lang.reflect.AccessibleObject; you should be able to work out the way round this from there.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reflection Problem
 
Similar Threads
what will happen if the program is like this
Constructors and interfaces
khalid mughal mock
Interface implement
When do we invoke a method using a dot notation?