0

I'm trying to get a class whose instance has already been created and I want to use that instance. The name of the needed class and the correct package is specified. However. I'm getting an java.lang.IllegalStateException stating that the specified class could not be found. All of the package names and the imports in each class have been checked and they all match.

Does anyone knows why this is being generated please?

ict1991
  • 2,060
  • 5
  • 26
  • 34
  • 2
    could you please show the code that is trying to do what you are saying. Your description is a little confusing because it is unclear what you mean by "whose instance has" and "that instance" - it's almost like you're implying there is only one instance. It would also be helpful if you post the stacktrace and some details of the class you're trying to load. – fommil Aug 02 '12 at 07:42
  • there is only one instace in fact as I am using Singleton to create just one instance and always trying to retrieve it... ill try to identify the most important parts of the code as not all of it was implemented by me and i'll paste it – ict1991 Aug 02 '12 at 07:47
  • Aah, ok. That makes a lot more sense - it sounded like you were trying to instantiate a class with reflection. Then the most important part will be the static initialiser, the lazy initialisation code (if any) and the stacktrace. – fommil Aug 02 '12 at 07:56

1 Answers1

1

its possible the wanted class isnt on your runtime class path. for more info read this: http://docs.oracle.com/javase/tutorial/essential/environment/paths.html

radai
  • 23,949
  • 10
  • 71
  • 115
  • wouldn't that be a [`ClassNotFoundException`](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassNotFoundException.html) ? – fommil Aug 02 '12 at 07:57
  • I checked out the variables for the java bin and they are ok... however I am executing the code in a web application, and some of the code is working fine, so I dont think its actually from the path – ict1991 Aug 02 '12 at 08:07