Re: Java and PHP
| From: | smallsnake | Date: | Fri, 11 Aug 2000 03:28:32 +0000 |
| Subject: | Re: Java and PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11262@lists.php.net to get a copy of this message | ||
(1)I wirte a simple java program
/*test.java*/
public class test{
public int ret_test(int i)
{
if (i>0) return 31;
if (i==0) return 30;
if (i<0) return 29;
return 100;
}
}
(2)compile the java class as test.class
(3)copy test.class to e:\php4\ext
(4)Add the classpath "e:\php4\ext" to my system environment.
(5)write test.php as:
<?
$b = new Java("test");
$x=$b->ret_test(4);
echo $x;
?>
(6)restart computer
(7)visit test.php,but get error:
Warning: java.lang.ClassNotFoundException: test in
E:\php\program\java\test.php on line 3
Fatal error: Call to a member function on a non-object in
E:\php\program\java\test.php on line 4
Help me!!
Thanks a lot bout any advice.
small snake
""Nold, Mark"" <Mark.Nold@normandy.com.au> wrote in message
news:0152D67E9890D31191F30000F87969478B4A6A@PTS001...
> --------------------------------------------------------------------------
--
> -----------------
> Disclaimer: The information contained in this email is intended only for
the
> use of the person(s) to whom it is addressed and may be confidential or
> contain legally privileged information. If you are not the intended
> recipient you are hereby notified that any perusal, use, distribution,
> copying or disclosure is strictly prohibited. If you have received this
> email in error please immediately advise us by return email at
> postmaster@normandy.com.au and delete the email document without making a
> copy.
> --------------------------------------------------------------------------
--
> -----------------
>
> I havent tried using SQL and Java from PHP (im not sure why you'd want to
> but thats another issue) but your problems could have something to do with
> the fact that PHP doesnt honour the class path set in your system
> environment. That is you must set up the CLASSPATH in your PHP.INI.
>
> The other fact is that php (as of PHP4 pl1) doesnt use . as a valid
> classpath. So you have to have your class's somewhere in your classpath
not
> your current directory.
>
> I wrote a small .php with some more info and examples. If you want it just
> mail.
>
> mn
>
>
> Mark Nold
> markn@alverstone.com.au
> Systems Consultant
>
> Change is inevitable, except from vending machines.
>