Re: Java in PHP4
| From: | Richard Lynch | Date: | Thu, 04 Jul 2002 21:58:43 +0000 |
| Subject: | Re: Java in PHP4 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105524@lists.php.net to get a copy of this message | ||
>Hi,
>I'm really new to Java in PHP, and curious to this great features.
>Q: How do I convert the sample code below so that it can run within PHP?
>
>===============================================================
>import com.my.sm.api.*;
>import com.my.sm.api.interfaces.*;
>
>public class my1
>{
> public static void main(String args[]) {
> if (args.length != 3) {
> System.err.println("Usage : java my1 <server> <username>
> <password>");
> return;
> }
>
> System.out.println("Starting Engine..");
> String server = args[0];
> String username = args[1];
> String password = args[2];
> ApiSession session = null;
>
> try {
> session = ApiSession.openSession(server, username, password);
> } catch (RuntimeException e) {
> System.out.println(e.getMessage());
> return;
> }
>
>
> }
>}
>
>=====================================================
>FYI, I'm using PHP 4.2.1 with Java extension and JDK1.3.
I think it's:
<?php $java = new Java('my1');?>
Better examples at http://conf.php.net in Rasmus' talks, I
think.
--
Like Music? http://l-i-e.com/artists.htm