Possible Duplicate:
Convert String to code
I have a program that needs to be able to execute a string as code. For example, I would have a string that reads:
public void do(int a, int b){
a++;
b--;
System.out.println(a);
System.out.println(b);
}
Now, how do I get the program to execute that string?
You can wrap this string in a class and compile it with Java Compiler API. You would have to be running JDK instead of JRE.