Re: PHP & JAVA

From: Date: Thu, 16 Nov 2000 23:29:13 +0000
Subject: Re: PHP & JAVA
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25820@lists.php.net to get a copy of this message
Jon and Steven, This is one of the samples that's shipped along with the PHP source which shows how you can reference Java classes and access their corresponding members. <html> <? $system = new Java("java.lang.System"); print "Java version=".$system->getProperty("java.version")." <br>\n"; print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n"; print "OS=".$system->getProperty("os.name")." ". $system->getProperty("os.version")." on ". $system->getProperty("os.arch")." <br>\n"; $formatter = new Java("java.text.SimpleDateFormat", "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz"); print $formatter->format(new Java("java.util.Date"))."\n"; ?> </html> Look in the ext/java directory of the PHP source distribution for a readme that explains how to build and configure this extension. BTW, there is also a servlet module which allows using a servlet container (e.g. Tomcat) to process your PHP scripts so that any Java access you do in them is actually running on the application server and there is no need for PHP to start up and manage a JVM. If you're on Win32 you can simply download the additional binaries for the Java or Servlet modules rather than building them yourself. Alex

« previous php.general (#25820) next »