Javassist can generate and load at runtime classes and methods from Strings of source code.
It is also possible to dump in the file system the generated class if you need to.
Currently there are minor limitations in the code you can pass in those strings, for example it cannot include generics, enumerations, or autoboxing and inboxing of primitives.
More information here:
http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/