Run contents of string in java -


this question has answer here:

lets have string: string run = "system.out.println\(\"hello\"\)". want run in string output hello in console. maybe there method string.run()?

try beanshell , build app jar library.

import bsh.interpreter; private void runstring(string code){         interpreter interpreter = new interpreter();     try {          interpreter.set("context", this);//set variable, can refer directly string          interpreter.eval(code);//execute code     }     catch (exception e){//handle exception         e.printstacktrace();     } } 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -