Does anyone know if it’s possible to convert a String/file into java source which can be compiled at run time using something like JavaCompiler. It looks like this is possible with Java 6, but I haven’t seen anyone say that JavaCompiler is available in Android.
Basically my main goal is to turn a String or file text into source code in Android. Does anyone know how that can be done?
Thanks!
Android runs Dalvik not Java 6. JavaCompiler is not included in standard Dalvik distribution, so you cannot use it. Dalvik runtime is designed for embedded system as such it is less dynamic, compiling code on the fly is one of the things that it is not supposed to do.
Try what Hyangelo suggested, or Google for other scripting libraries. Clojure for example. 😉