-
1. Re: How to get an instance of a a class create with makeClas
chiba Aug 29, 2004 12:08 PM (in response to mxc4)You must explicitly load the class file you newly
defined and create an instance of that by the
reflection API (java.lang.reflect).
The latest version of Javassist, which you can
download from CVS HEAD, provides a very
convenient method toClass() for doing that.
Please try. -
2. Re: How to get an instance of a a class create with makeClas
bwilmot Sep 12, 2004 7:16 PM (in response to mxc4)I still have a problem understanding the answer. Say for instance I create a new class with javassist named myClass and build into it three variables called x1 x2 and x3.
Now the answer on how to create an instance if myClass seems easy, but how do I avoid compiler erros on my main prorgam when attempting to access x1, x2 and x3? -
3. Re: How to get an instance of a a class create with makeClas
chiba Sep 13, 2004 10:34 AM (in response to mxc4)No, you cannot avoid compiler errors if you
directly access such fields as x1, x2, and x3.
Instead, you must use the Java reflection API
for accessing those fields.