RE: [PHP] PHP & Java, calling a static method
| From: | Chris McCluskey | Date: | Thu, 08 May 2003 23:00:32 +0000 |
| Subject: | RE: [PHP] PHP & Java, calling a static method | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146931@lists.php.net to get a copy of this message | ||
My reply, below...
-----Original Message-----
From: Wendy [mailto:OpenSourceAZ@cox.net]
Sent: Wednesday, May 07, 2003 7:02 PM
To: Chris McCluskey
Cc: php-general@lists.php.net
Subject: RE: [PHP] PHP & Java, calling a static method
On Wed, 2003-05-07 at 14:44, Chris McCluskey wrote:
> Ah ha!! Ok, I thought you would be re-writing everything in PHP.
Which
> would work out perfectly. By what you have said I would guess that if
> you can't call it as
> $myObject = new Java( "Object.staticMethod()" );
> you might be SOL. And I'm guessing you've tried:
> $myObject = new Java( "Object" );
> $myObject->staticMethod();
> right? That would be my next best guess.
Nothing works. :( I do have a workaround, it just means exposing the
database a little more than I wanted to. I may rewrite the Java layer
to work better with PHP. But I don't think this is an unreasonable
request, it just sounds like something whoever wrote the Java extension
didn't have a need for. So where are they hiding so I can talk to them?
Hiding? Hmm.. not sure. My personal experience with the PHP folks is
if they do something they generally do it right, leading me to belive
that there is a way to do this in PHP, I'm just not sure off the top of
my head.
I assume you mean rewriting the java layer to work without static
methods? I'm thinking you're right, that would solve your problem.
> Personally, I've kept my java work with my java work and my php work
> with my php work. If you have a lot of code already in java you might
> want to look into JSP/J2EE if you haven't already.
I'm a Java programmer first, Servlets/JSP/Struts, the whole nine yards
on the server side. There is a Java API to my database (IBM's UniData)
and I've written a data access layer in Java. Now I have a need to
access the database from a website that's all PHP. So... I can't write
the Java classes in PHP, and I can't drag the website over to Java.
The database also has a C API, and I'm now wondering if that might not
be a better way in rather than going through Java. Or is it six of one,
half dozen of the other?
Haha, that's a good comparison. I guess in c, you could create a COM
object (assuming you are running on a windows box) and use new COM() in
PHP. But once you go through all that, you could be left with the same
problem. I think if I were you I would remove the static methods, (or
rather, rewrite them to work non statically), or re-write the thing in
PHP (yeah, go with door number 2, whoo hoo!)
=)
Thanks again for your response!
Glad to help.
--
Wendy Smoak
Chandler, AZ