Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2004

Tip: Looking for answers? Try searching our database.

Dynamic class creation

Thread view: 
Charles Fox - 13 Jul 2004 15:13 GMT
Could someone please point me to a good tutorial on dynamic class
creation?  I'm building machine learning models, which need to invent
and their own classes as they go on.  I seem to remember that Java can
do this somehow.
Andrew Thompson - 13 Jul 2004 15:43 GMT
> Could someone please point me to a good tutorial on dynamic class
> creation?

What are some URL's of the bad ones?

Signature

Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

Chris Smith - 13 Jul 2004 18:32 GMT
> Could someone please point me to a good tutorial on dynamic class
> creation?  I'm building machine learning models, which need to invent
> and their own classes as they go on.  I seem to remember that Java can
> do this somehow.

You'll want to start out by reading the VM specification.  You will end
up implementing your own ClassLoader, so look up java.lang.ClassLoader
in the API docs.  Then take a look at:

   http://java-source.net/open-source/bytecode-libraries

Many of those products almost certainly have tutorials and sample code.  
The only one I've used is BCEL, so I can't give recommendations, but I
know Javassist and cglib are also generally popular.

Signature

www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Roedy Green - 13 Jul 2004 20:57 GMT
>Could someone please point me to a good tutorial on dynamic class
>creation?  I'm building machine learning models, which need to invent
>and their own classes as they go on.  I seem to remember that Java can
>do this somehow.

see http://mindprod.com/jgloss/jasm.html

It is not great, but it is what I have.

Signature

Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Tor Iver Wilhelmsen - 14 Jul 2004 11:25 GMT
> Could someone please point me to a good tutorial on dynamic class
> creation?  I'm building machine learning models, which need to invent
> and their own classes as they go on.  I seem to remember that Java can
> do this somehow.

I would recommend a different approach, where you dynamically create
sequences of "callable objects", perhaps following the Command or
Strategy pattern. Write (not synthesize) classes for the "atomic
operations", and make a class for a sequence of these atomic
operations. Then have the machine learning bit adjust parameters,
sequences etc. in these callable objects, instead of generating new
classes.
Chris Uppal - 14 Jul 2004 14:05 GMT
> Could someone please point me to a good tutorial on dynamic class
> creation?  I'm building machine learning models, which need to invent
> and their own classes as they go on.  I seem to remember that Java can
> do this somehow.

Assuming that you don't want to follow Tor's very sensible suggestion, and
adding to Chris's recommendations:

You will probably find some useful stuff in the GNU Kawa project -- a Scheme
system that dynamicaly compiles to Java bytecodes.

   http://www.gnu.org/software/kawa/

I have seen comments to the effect that the bytecode generation library in Kawa
is easier to use than Apache BCEL, but I haven't used either of them myself.

You might also want to look for the book:

   Programming for the Java Virtual Machine
   Joshua Engel

which talks quite a lot about compiling non-Java to run on the JVM.

   -- chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.