1

I have a class name String and a String which containing the class code. For example, "Example" is the name of the class, and

public class Example {
    public void example () {System.out.println ("Hello world!"); }
}

The class code.

I looked at the Dexmaker library, but I did not understand if it's possible to compile the generated code into it. And the question is just how to compile the code string under Android?

2 Answers2

0

Not sure if possible at all the compilation within the embedded system but definitelly you can parse and run the code using beanshell: http://www.beanshell.org/

it is lightweight and easily to embed in your app. Then you can instance the generated class and run whatever you put inside.

eduyayo
  • 2,020
  • 2
  • 15
  • 35
0

There is only one true way: using DexMaker. All examples you can find on DexMaker wiki and especially for current problem (runtime generation code on android).