1 posts in topic
Flat View  Flat View

Posted By:   Anonymous
Posted On:   Friday, May 17, 2002 04:19 AM

I am working under JBuilder 5, with Borland AppServer 4.5.

I am using the method defineClass from the class ClassLoader to load a class that i retrieved as an InputStream from JDataStore. I then resolve the class with the method resolveClass .

I don't have any problems in loading the class and invoking its methods but if I try to use the class I loaded in an explicit cast, I get a ClassCastException.

If there's anything I could do to prevent this from happeneing, please tell me.


Re: ClassCastException

Posted By:   Simon_Ablett  
Posted On:   Friday, May 17, 2002 05:46 AM

ClassCastExceptions are instances of RuntimeException that are thrown when an attempt is made to cast an instance of a class to another class and that cast is not allowed. For example, if you try to cast a String object to an Integer then it will result in a ClassCastException being thrown.

Make sure that the cast you are attempting is valid.

About | Sitemap | Contact