Problem with ClassLoader

Vishal Goenka (vgoenka@novell.com)
Tue, 10 Mar 1998 00:42:06 -0700

Message-Id: <s5048d04.016@novell.com>
Date: Tue, 10 Mar 1998 00:42:06 -0700
From: "Vishal Goenka" <vgoenka@novell.com>
To: java-security@web1.javasoft.com
Subject: Problem with ClassLoader

I'm writing my own class loader that subclasses java.lang.ClasLoader and =
instantiates a class after extracting the byte codes defining the class =
from some proprietary file format. In order to use the methods of this =
class, I need to typecast the Object (instantiated using newInstance() on =
the Class returned by my classloader's loadClass method) to its real class =
name (say X), but the file X.class is not in the classpath, since it =
doesn't exist in the first place. The class X was created by my classloader=
, and I expect that the class definition is available to java runtime, =
still, I get ClassDefNotFound error when typecasting the class as :
X myX =3D (X)obj; // Assuming obj was the object created as discussed =
above.

Kindly help. I can produce sample code if the problem is not clear. Is =
this a feature or a bug. Please elaborate.

Thanks and regards,
Vishal Goenka
Novell