note 68705 added to ref.java

From: Date: Tue, 08 Aug 2006 09:10:59 +0000
Subject: note 68705 added to ref.java
Groups: php.notes 
Request: Send a blank email to php-notes+get-115626@lists.php.net to get a copy of this message
I have successfully integrated PHP and Java using php-java bridge. I want to have notes on how to use this package. I am able to run small java programs including Threads too. e.g. php: <? $thread=new Java('java.lang.Thread'); for($i=0;$i<10;$i++){ echo " \n ". $i . " hello "; $thread->sleep(1000); } ?> OUtput: Code: C:\test\javatest>php test4.php 0 hello 1 hello 2 hello 3 hello 4 hello 5 hello 6 hello 7 hello 8 hello 9 hello Another small program php: <? class MyThread{ function __construct($msg){ $obj=new JavaClass("java.lang.Thread"); $thread=$obj->newInstance(); $thread->setName($msg); echo " \nThread " . $thread->getName() . " Running "; $thread->sleep(3000); } } $a= new MyThread("hello world"); $b= new MyThread("there is me"); ?> Output: Code: C:\test\javatest>php test6.php Thread hello world Running Thread there is me Running But I wanna know how we can extend any Java class in php and override any methods. e.g. If we are extending Thread class , then how can we override public void run() method and start the thread. Further do we have any synchronized keyword as we have in Java. ---- Server IP: 216.194.113.175 Probable Submitter: 155.35.46.11 (proxied: 155.35.20.240) ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/ref.java.php Edit -- https://master.php.net/note/edit/68705 Del: integrated -- https://master.php.net/note/delete/68705/integrated Del: useless -- https://master.php.net/note/delete/68705/useless Del: bad code -- https://master.php.net/note/delete/68705/bad+code Del: spam -- https://master.php.net/note/delete/68705/spam Del: non-english -- https://master.php.net/note/delete/68705/non-english Del: in docs -- https://master.php.net/note/delete/68705/in+docs Del: other reasons-- https://master.php.net/note/delete/68705 Reject -- https://master.php.net/note/reject/68705 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115626) next »