Add Intrepreter to application?
Hi all. I was wondering if this is possible in Java. If i have a Client Java application, can I have a "mini" compiler in the application that can read JAVA code runtime (compile it?) and perform the actions in the code based on classes already defined in the application i am compiling this code in?
This would be neat to add code during the life of the application. Thanks for any help in advance.
Re: Add Intrepreter to application?
Take a look at the javax.tools package. Be aware that for compilation to succeed, it is required that a JDK be installed. Just a JRE won't do.
Then you'll probably need a custom ClassLoader and the Reflection API to load the compiled classes. It doesn't take long for all of that to become very messy.
This would be neat to add code during the life of the application.