|
From: <php...@li...> - 2010-05-30 11:22:29
|
Trying to call a PHP script from a Java program.
My Java program (Test.java) is this:
ScriptEngine e = ( new ScriptEngineManager() ).getEngineByName( "php-invocable" ); e.eval( EngineFactory.createPhpScriptReader( "hello.php" ) ); System.out.println( ( ( Invocable)e ).invokeMethod( e.get( "php.java.bridge.PhpProcedure" ), "f", new Object[]{} ) ); ( (Closeable)e ).close();
The file hello.php is this:
<?php require_once( "java/Java.inc" );
function f() { return java_server_name(); };
java_call_with_continuation( java_closure() );?>
when I run from a terminal: java -cp .:./JavaBridge.jar:./php-script.jar:./php-servlet.jar:./java Test
I get this: java.lang.NoSuchMethodException: f
In my directory I have:
hello.phpjava/Client.incGlobalRef.incJavaBridge.incJava.incJavaProxy.incJavaProxy.phpNativeParser.incOptions.incParser.incPHPDebugger.incPHPDebugger.phpProtocol.incSimpleParser.incJavaBridge.jarphp-script.jarphp-servlet.jarTest.class
I'm running on Ubuntu 10.04 desktop (and also testing on 9.10 desktop). I installed PHP5 (php5-cli and php5-cgi) via the Ubuntu repository and had to modified /etc/php5/cgi/php.ini and changed "allow_url_include = On".
Any ideas?
Thanks,
Bernard.
_________________________________________________________________
New, Used, Demo, Dealer or Private? Find it at CarPoint.com.au
http://clk.atdmt.com/NMN/go/206222968/direct/01/
|