RE: [PHP] PHP & Java, calling a static method

From: Date: Wed, 07 May 2003 21:44:57 +0000
Subject: RE: [PHP] PHP & Java, calling a static method
Groups: php.general 
Request: Send a blank email to php-general+get-146745@lists.php.net to get a copy of this message
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. 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. -Chris -----Original Message----- From: Wendy [mailto:OpenSourceAZ@cox.net] Sent: Tuesday, May 06, 2003 6:55 PM To: Chris McCluskey Cc: php-general@lists.php.net Subject: RE: [PHP] PHP & Java, calling a static method On Mon, 2003-05-05 at 14:14, Chris McCluskey wrote: > The direct conversion would be: > From: > DAOFactory udFactory = DAOFactory.getDAOFactory(); > To: > $udFactory = DAOFactory::getDAOFactory(); > That help? Sort of... that looks like the conversion I would use if I were going to rewrite the DAOFactory class in PHP. I tried it and got 'undefined class name' as expected. What I have is a Java class that has to stay in Java, and I need to use it from PHP. So typically you instantiate the Java object by using one of the constructors: $myObject = new Java( "JavaClassName()" ); But DAOFactory is a class that you can't use that way. You're supposed to use the 'getFactory' method on the class itself, and in fact you can't make an instance of the class. I can't figure out how to call a static method on a Java class from PHP. Thanks for your response! Do you have any idea where to find out more information on the experimental extensions? I'm sure the Java extension isn't widely used, but it will neatly solve a big problem if I can get it to work. -- Wendy Smoak Chandler, AZ

« previous php.general (#146745) next »