Hi,
=20
I am new to java so please excuse me if I am asking a stupid question.
My problem is I cannot access my own java class files from php.
=20
My OS is Windows XP I have PHP 5.0.3 running on Apache 2.0.54 with
module mod_jk2. I have deployed javabridge 2.0.7 under tomcat 5.5.9.,
using the excellent instructions at:
=20
http://mpcon.org/apacheguide/=20
=20
I can use built in classes such as getProperty('java.version') of
'java.lang.System', but the simplest application I can think of returns
the error "ClassNotFoundException: Class HelloPhp not found"
=20
The PHP code:
=20
<?php
java_set_library_path("%CATALINA_HOME%\webapps\JavaBridge\WEB-INF\classe
s\php\java\servlet");
$useless =3D new Java_class('HelloPhp');
$result =3D$useless->HelloPhp();
echo $result;
?>
=20
The HelloPhp.java class code:
=20
// HelloPHP.java test of JavaBridge
=20
public class HelloPhp
{
public static String main()
{
return "Hello PHP" ;
}
}
=20
I have tried placing the class HelloPhp.class file in every directory I
can think of, with/without corresponding java_set_library_path('..') but
to no avail. The class works from a test calling program from the
system prompt, provided the CLASSPATH environmental variable is set.
=20
The reason for thinking the above path is the most likely candidate is I
have noticed that if I restart Tomcat I get once only the error:
=20
"ReferenceClass failed: new HelloPhp. Cause:
java.lang.IllegalArgumentException] thrown" however refreshing the page
reverts to the above "ClassNotFoundException:"
=20
Any help would be much appreciated.
=20
David
=20
|