As time went by, the two bright spots became brighter, and soon they were liked by programmers, so there was a question: what would happen if they met? Is it possible to combine their strengths?
Try to build a bridge between PHP and Java, using this bridge to build a communication channel between the two entities, with the help of this bridge, you can develop classes in Java and then invoke their methods in PHP, as well, You can also use PHP scripts in your Java desktop or Web application.
In this article, you will learn how to:
Installing and configuring the Php/java Bridge
Using Java classes in PHP scripts
Using PHP scripts in Java classes
Using PHP scripts in JSP pages
So let's get started!
Installing and configuring the Php/java Bridge
The latest Php/java Bridge ZIP package is available for download in http://sourceforge.net/projects/php-java-bridge/, and the installation process relies on choosing which Java platform to interact with the PHP script through the bridge.
For J2SE, installation is simple:
Installing J2SE 1.6 or later
Install PHP 5.1.4 or later
Unzip the Php-java-bridge_5.2.2_j2ee.zip bag
From the command prompt, enter the directory you just unzipped, and enter:
>java? classpath Javabridge.war testinstallation
Under this folder, you should see an ext directory, which includes four. jar files, and copies the Javabridge.jar and Php-script.jar to the Ext folder in your J2SE installation directory (usually {java_home}/jre/ Lib/ext).
For the Java EE, perform the following installation steps:
Copy the Javabridge.war file to the Auto_deploy folder under your Java EE server or the servlet engine (tomcat,resin, etc.).
Rename the file according to your application, then restart the Java EE Server and wait for the automatic deployment process to create the directory associated with the. war file, in this case the application is called Appname.war.
Test the new application from the browser, enter: Http://localhost:8080/appName, and then click Test.php.
If your Java EE server is running on a different host and port, the parameters should be modified accordingly.
Note: If you want to run the j2ee/php application on Apache or IIS, copy the directory that includes the appname to the Apache/iis document root directory.
http://www.bkjia.com/PHPjc/319584.html www.bkjia.com true http://www.bkjia.com/PHPjc/319584.html techarticle As time went by, the two bright spots became brighter, and soon they were liked by programmers, so there was a question: what would happen if they met ?