Erlang Mailing Lists

Author Message

<  Erlang  ~  Erlang port + java while loop

ea6611
Posted: Mon May 17, 2010 5:28 pm Reply with quote
User Joined: 30 Apr 2010 Posts: 5006
Hi,
I am using open_port and port_command to interact with a java program.
The java program is simple and works fine with erlang:
Code:

import java.util.Scanner;
import java.lang.String;

public class ReadString {


public static void main(String[] args) {

   String dest,command,body;   
   System.out.println("inside main********");
   Scanner in = new Scanner(System.in);
   command = in.next();
        System.out.println("JavaCommand :"+command);
           
          if (command.equals("test"))
          System.out.println("Testing : "+command+" OK");

   if (command.equals("exit"))
   in.close();   
    }
}


Now I want to add a while loop to keep the java prog running:
Code:

import java.util.Scanner;
import java.lang.String;

public class ReadString {


public static void main(String[] args) {

   String dest,command,body;   
   System.out.println("inside main********");
   Scanner in = new Scanner(System.in);
do
{
        command = in.next();
        System.out.println("JavaCommand :"+command);
           
          if (command.equals("test"))
          System.out.println("Testing : "+command+" OK");

   if (command.equals("exit"))
   in.close();
}while(!command.equal("exit"));   
    }
}


this compiles right but at the execution nothing happens (even the "inside main********" doesn't show up)
is there something else to import?
View user's profile Send private message
Michal Ptaszek
Posted: Wed May 19, 2010 2:35 pm Reply with quote
User Joined: 01 May 2008 Posts: 35 Location: Krakow
I think Java should have some kind of System.out.flush() somewhere. When I was using Erlang and Python scripts as external ports it turned out to be very helpful when forcing messages to appear on the other side.

Moreover, if you would like to bind java and erlang, look at the Jinterface: http://www.erlang.org/doc/apps/jinterface/jinterface_users_guide.html
View user's profile Send private message
ponik
Posted: Mon Aug 29, 2011 9:09 am Reply with quote
Joined: 29 Aug 2011 Posts: 4
Good work chap, continue doing. Think some kind of System.out.flush () is there somewhere in Java. Long time back when I was using Erlang and Python scripts as external ports, I tried to force messages to appear on the other side and it drive out to be very helpful with ingersoll rand security technologies . Moreover, if you would like to bind java and erlang, there is lots of information available in net.


Last edited by ponik on Mon Sep 05, 2011 7:16 am; edited 1 time in total
View user's profile Send private message
wuji
Posted: Fri Sep 07, 2012 6:58 am Reply with quote
User Joined: 10 Aug 2012 Posts: 654
peak in the 1920s, when 40 people lived there."The town town [h1]imitation designer *beep*[/h1] town doesn't exist," said Elizabeth Alvarez, Texas Almanac editor. "I
know what the wording of the ad was, but he he real jordans he must have purchased some land where the town site
It's not like purchasing a town, because it's not a a knockoff designer *beep* a town and hasn't been for a really long time."Alvarez
Bankersmith is located in what denizens refer to as Texas Texas cheap real jordans Texas Hill Country in south central Texas.Guller is the de-facto
of the unincorporated town, and said he has plans to to cheap polo ralph lauren to appoint a sheriff and a postmaster. He is working
a Bikinis Bill of Rights, he said.Guller said he's even even knockoff designer *beep* even deciding on town slogans."The two I've come up with
'
View user's profile Send private message
dongdongwu
Posted: Wed Sep 19, 2012 8:27 am Reply with quote
User Joined: 19 Sep 2012 Posts: 236
Girls would refuse to even leave their replicas behind. specifically when the product beats the complete meaning of the Christian Louboutin men outlet; in conditions of good quality and detailing.If Cinderella was residing in your twenty primary century as opposed to the aged a single then there would not be any 'Happy actually after'. properly appears like girls nowadays are as well fond of the strong;Christian Louboutin Men Shoes to leave them in your center of nowhere.Christian Louboutin for men Shoes would arrive true handy being a excellent handbag using the glimpse and really feel belonging to the authentic but at a very much lesser price tag adding as very much as types picture in your process.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum