Java Techniques to Simulate VB's "Evaluate"
Posted on 2001-06-13
VB and Rexx (both interpreted) had a way to RUN some text as a program statement.
I know you can do similar things, like this:
String name = "BJ" + someStringVar
java.lang.Class c = java.lang.Class.forName(name);
mbj = (BatchJob)(c.newInstance());
1) Can you think of other examples where java can build then run something?
But maybe you get some text out of a database or something and you build a valid Java program statement. Now you want to run it. I guess you can't do that in Java because you've already gone to bytecode with it. You'd need to generate bytecode on the fly and make it available to the JVM. 2) I think I've answered my own question, but can you do that in Java?