问题 I have a String that I need to convert to java class, compile and create an instance at run time: Suppose my String is: String s = " public class Test { public Double add(Double x, Double y){ return (x+y); } }" How can I convert it to a class Test .class, instantiate it and call the method add(Double x, Double y) at run time? I read about Byte Buddy , but the examples I see has a class already defined. In a situation like the above, could anyone give an example how can I use ByteBuddy or any