yes, it can be done. you can spit the string out to a .java file, and compile it either by spawning a new process to run javac on it, or you could use the javac facade in tools.jar, or I believe - but may have been misinformed - that the javac facade is in the JDK itself as of 1.6. you'd then have to load the class dynamically