RE: Problem installing java extension on NT4.0
| From: | Nold, Mark | Date: | Wed, 28 Jun 2000 03:56:32 +0000 |
| Subject: | RE: Problem installing java extension on NT4.0 | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-717@lists.php.net to get a copy of this message | ||
----------------------------------------------------------------------------
-----------------
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.
----------------------------------------------------------------------------
-----------------
Joseph,
Another interesting thing i have found with the use of classes is that in
PHP instantiating a new class doesn't call the main function.
Im not a big java-head so im not sure how correct this approach is, but if
you run "java imgtest" it will run the main method and get on with the job.
In PHP you have to be more specific, if my .java was:
package foo.bar;
public class imgtest{
public static void main(String argv[]){
new imgtest();
}
public String imgtest(){
// Generate and write an image to disk and return the image location.
}
}
Then to generate my image via PHP i would have to explicitly call imgtest()
and it doesnt appear i could call main("");
$mychart = new Java("foo.bar.imgtest");
$src = $mychart->imgtest();
echo "<img src='$src' border=0>";
Now the other piece of info i found is that whilst java and appletviewer are
fine if i declared "public imgtest()", PHP requires you to have "public Void
imgtest()" so it looks like you must explicitly declare a void (or Null)
return type in Java to work with PHP.
The other trick to watch out for is your classpath. A class may work from
the command line and not in PHP because your classpath isnt sufficient to
handle the import's used in your java .class So this can also be a problem
which is hard to track do to the odd messages the PHP Java implimentation
returns (im not sure if this is just Windows or every implimentation).
Im not sure if any of this is relevant, but who knows ;)
I would like to know a bit more about the servlet interface and why you
would want to do this with PHP? Any info? Also i can jver.php but not
jawt.php working, any luck?
I also dont know what you mean by web.xml what file is this and what readme
are you looking at?
mn
-----Original Message-----
From: Joseph Okomba [mailto:Okomba@kabage.co.ke]
Sent: Tuesday, June 27, 2000 5:12 PM
To: Nold, Mark
Cc: 'php-windows@lists.php.net'
Subject: RE: Problem installing java extension on NT4.0
Hi Mark. I am sorry for bothering you again.
While I was excited to have one of the Java examples run under PHP, My
excitements were shorlived as the example you had send didn't run. Also I am
unable to run the servlet examples. I have changed the web.xml as advised in
the README. However I keep getting errors whenever I try the servlet
examples.
I will greatly appreciate any assistance. Thanks in advance.
> -----Original Message-----
> From: Joseph Okomba
> Sent: Tuesday, June 27, 2000 10:37 AM
> To: 'Nold, Mark'
> Subject: RE: Problem installing java extension on NT4.0
>
> Many thanks Mark. I am now able top run Java under PHP.
>
> -----Original Message-----
> From: Nold, Mark [SMTP:Mark.Nold@normandy.com.au]
> Sent: Tuesday, June 27, 2000 7:06 AM
> To: 'Joseph Okomba'; 'php-windows@lists.php.net'
> Subject: RE: Problem installing java extension on NT4.0
>
>
> --------------------------------------------------------------------------
> -------------------
> 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.
>
>
> --------------------------------------------------------------------------
> -------------------
> Joseph,
>
> Hopefully the attached helps. Just put it on your web server and
> change the extension so it is parsed by PHP on your machine then read the
> instructions. Just make sure you get the various directories correct for
> your installation.
>
> The instructions should make sense and show you how to call standard
> java classes (this is actually an example from the PHP teams readme's etc
> which you should also look at), plus an example javaclass of my own and
> how to make it work with PHP.
>
> From your mail it would appear that you have the
> java.library=C:\jdk1.2.2\jre\bin\classic\jvm.dll incorect.
>
> If you have any feedback on these notes i'd love to hear em.
>
> mn
>
>
> -----Original Message-----
> From: Joseph Okomba [ <mailto:Okomba@kabage.co.ke>]
> Sent: Monday, June 26, 2000 2:21 PM
> To: 'php-windows@lists.php.net'
> Subject: Problem installing java extension on NT4.0
>
>
> I have installed php4.0 with java extension but I keep getting the
> following
> error message whenever I load any of the accompanying examples:
>
> Fatal error: Unable to create Java Virtual Machine
>
> I am using JDK1.2.2 with IIS4.0.
>
> I will appreciate any assistance to sort out this error.
>
> Thanks in advance
>
>
>
> << File: javatest.htm >>