| Home | Facebook | Freeware |

Wednesday, March 30, 2011

Menjalankan Javascript dari Java

import javax.script.*;
public class ExecuteScript {
public static void main(String[] args) throws Exception {
// create a script engine manager
ScriptEngineManager factory = new ScriptEngineManager();
// create a JavaScript engine
ScriptEngine engine = factory.getEngineByName("JavaScript");
// evaluate JavaScript code from String
engine.eval("print('Welcome to java world')");

thanks to : http://metoojava.wordpress.com/2010/06/20/execute-javascript-from-java/


The Foothills homes for sale said...

I always have questions about running javascripts.. javascripts itself is very interesting but sometimes I find hard to understand.. Thanks you!