Filter object is where we add some data from PHP. Public static void main(String args) throws InterruptedException Public static final String JAVABRIDGE_PORT = "8080" Public static Counter counter = new Counter() So you simply need to run this program and it will infinitely listen for incoming 8080 connections. main class, it waits for PHP requests. So we got everything we need for the demo, now implementation itself:įirst of all, let’s create our Java application (in NetBeans i created a new Java project called `JavaBridgeDemo` & also added JavaBridge library to it: Right click your project -> properties -> Libraries -> Compile -> Add Jar/Folder -> Select JavaBridge.jar library defaults are used for everything else (for example Main Class `javabridgedemo.JavaBridgeDemo` will be created by NetBeans as well)). – create Java project, call it JavaBridgeDemo (btw i use Netbeans for my PHP and Java projects) – now create a PHP project (create index.php and copy Java.inc there) – download JavaBridge.jar library (you will need to add it to your Java project) and Java.inc (you will need it for PHP) from – then, in PHP, we need to pass filter to Java counter object and get results as string to PHP – we need to pass it to Java filter (our custom) object – in PHP we have specific array to be processed by Java – we have a PHP project which needs Java help In this tutorial let’s look at simple application using PHP/Java bridge so you could get the idea on how everything works. So you want to use Java from PHP for some fast calculations (or custom Java-specific operations) and get result of those calculations back to PHP.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |