How tom create a NEW class online

A

Alexander

Here is my problem:
I need to create a NEW class online, during code execution. A class
with members only (no methods), but one that inherits base class or
implements empty interface.
There is no neither *.class file nor *.java (text) file.
This is a part of my thesis, so work around is not an option (at
least not to create text file with java code and compile). I thought
that a reflection can help me, but nothing helpfull was found.
How can I do this? (or at least if this is impossible – tell me )

Thanks
 
T

Tor Iver Wilhelmsen

This is a part of my thesis, so work around is not an option (at
least not to create text file with java code and compile). I thought
that a reflection can help me, but nothing helpfull was found.

Reflection is for analysing and using existing classes. You want to
synthesize a class, there are tools/APIs for that, though I cannot
remember any at the moment.
 
E

Eric Sosman

Alexander said:
Here is my problem:
I need to create a NEW class online, during code execution. A class
with members only (no methods), but one that inherits base class or
implements empty interface.
There is no neither *.class file nor *.java (text) file.
This is a part of my thesis, so work around is not an option (at
least not to create text file with java code and compile). I thought
that a reflection can help me, but nothing helpfull was found.
How can I do this? (or at least if this is impossible – tell me )

The defineClass() methods of java.lang.ClassLoader
may be what you want.
 
A

Alexander

I think this is the one , thank you very much!
If someone knows something else , please inform me!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top