• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to invoke the static class using classloader.  RSS feed

 
Viswanathan Ramasamy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I'm having two class class A and Class B.
Class A is static and in class B i'm trying to invoke the method of class A.
I'm getting following error.

java.lang.IllegalAccessException: Class com.infy.cis.fiservices.B can not access a member of class com.infy.cis.srmbo.A with modifiers "private"

But all the methods in class A and Class B are public only.

Note : In My class A default constuctor is private.

could you please help me one this issue.

with regards,
Viswanathan Ramasamy.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post your code? Its hard to help without seeing what you have done.

Also, this is not really an advanced question, so I'm moving it.
 
Stephen Foy
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the constructor in class a is private then it can only be accessed within that class. So it should be public or protected.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stephen Foy:
If the constructor in class a is private then it can only be accessed within that class. So it should be public or protected.


Well, but you don't need to call the constructor to invoke a static method - the private constructor shouldn't have any effect on that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!