Introduction
This article explains how to use Java Bridge to access Java classes from PHP. It discusses how to invoke Java methods and access fields (instance and static fields). Exception handling and type conversions between PHP and Java are also discussed.
ZSL, WebSphere SMash, and Apache Lucene
For a real example, this step-by-step article describes the creation of a simple search engine written in PHP that uses Apache Lucene to establish a file index and search. Apache Lucene is a high-performance fully functional text search engine library, full use of Java writing. This is a technology that works well for many applications that require full-text search.
ZSL use Apache LUCENE.ZSL in the WebSphere sMash application that it writes? Want to improve information sharing between their developers. To solve this problem, they created mashups to index source code and document libraries (PDF, PowerPoint, Word, Excel, and many other formats). This application provides the ability to quickly and easily access code snippets from across the enterprise.
Creating Applications in WebSphere SMash
The first step is to create a new project in Eclipse:
1. Select File-> New-> Project ... and expand the Zero directory in the dialog box.
2. Select WebSphere sMash PHP application and click Next, as shown in Figure 1.
3. Name the project (for example, Myjavaproject) and click Finish. Your project is now created.
Figure 1. Create New WebSphere SMash Project dialog box