Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Constructor Not Visible?

 
Arun Kumar Gaddam
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is Class file called org.smslib.InboundMessage which i want to use in my Project.so Just I Instantiated the Class By calling the Constructor....But the error coming was Construtor is not visible.......The class Contained three Overloaded Constructors ,not single one responding....I saw the sourse too no constructor was private or default.........Then what would the problem...........

Any Body please tell me the mistake .............
Thanks in Advance....................
[ February 01, 2008: Message edited by: Bear Bibeault ]
 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the class is in a different package, you'll have to import the class into your source file, using the keyword import.
 
Arun Kumar Gaddam
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have done with all the imports,setting classpaths all the necessary things but invain......the problem is constructor not visible.............
 
Deepak Chopra
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check ..may be the class is abstract..!!
can you tell us what is the exact error you are getting..!!
paste the same error here..!!
 
Arun Kumar Gaddam
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exact error is.............

Constructor InboundMessage(MessageTypes,String,int) is not visible
 
Campbell Ritchie
Sheriff
Posts: 48452
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post a bit of your code with the imports, class heading, the bit which isn't working, and the constructor and class heading for the InboundMessage class.
 
Mark Newton
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Please post a bit of your code with the imports, class heading, the bit which isn't working, and the constructor and class heading for the InboundMessage class.


Also, since you said you have the code for the class you're trying to instantiate, it probably wouldn't hurt to have a look at that - at least the constructors that are not visible.
 
Petrus Pelser
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked if maybe the class contains a static method for retrieving an instance? Something like getInstance(), or getInboundMessage(), etc.
 
Arun Kumar Gaddam
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This is my code........



And this is the construtors code..........
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

super(type, null, null)

The exception message is telling you that the constructor you call here is not visible, i.e. it is private or has package visibility. Are you sure the source you looked at is the source you are calling?

Because you pass null arguments, are you sure you are calling the constructor you think you are?
[ February 07, 2008: Message edited by: Paul Sturrock ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic