logo
To execute PHP from Java first create a ScriptEngineManager and use it to find a ScriptEngine. Then just pass your PHP-script as a String to the ScriptEngine's eval()-method:
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine eng = mgr.getEngineByName("turpitude");

try {
  eng.eval("echo(\"Hello World!\n\");");
} catch(ScriptException e) {
  System.out.println("ScriptException caught:");
  e.printStackTrace();
}
see: HelloWorld.java

Comments

Add Comment

name:
email:
homepage:
comment:
Please enter the following code into the "verify" field below:
Verify: