wood burning stoves 2.0*
The moose likes Java in General and the fly likes Creating Java classes on fly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Creating Java classes on fly" Watch "Creating Java classes on fly" New topic
Author

Creating Java classes on fly

Bob Mathews
Ranch Hand

Joined: Feb 26, 2006
Posts: 43
Hi all,

Can any one tell me how can I create Java classes on the fly.


Like if I provide name of the java class(fully qualified), with specification of its methods and fields how can I create java classes on fly.

Do I need some Byte code engg. or I can do it with Plane reflection

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Reflection only works on existing objects (and hence, classes). But you can construct classes from source code at runtime using a library like Javassist. This article I wrote for the JavaRanch Journal explains how it's done.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating Java classes on fly
 
Similar Threads
how to perform query on multiple tables dynamically? tables that has no mapped entity
Creating a Class on-the-fly
dynamic proxy creation
Puzzle
repainting problems...