From moeller@ebi.ac.uk  Fri Nov 17 17:58:34 2000
Received: from alpha1.ebi.ac.uk (root@alpha1.ebi.ac.uk [193.62.196.122])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id RAA17530
	for <prolog@swi.psy.uva.nl>; Fri, 17 Nov 2000 17:58:34 +0100 (MET)
Received: from mozart.ebi.ac.uk (mozart.ebi.ac.uk [193.62.196.62])
	by alpha1.ebi.ac.uk (8.8.8/8.8.7) with ESMTP id QAA20688;
	Fri, 17 Nov 2000 16:58:38 GMT
Date: Fri, 17 Nov 2000 16:58:38 +0000 (GMT)
From: Steffen Moeller <moeller@ebi.ac.uk>
To: Pierre Nugues <pnugues@greyc.ismra.fr>
cc: prolog@swi.psy.uva.nl, fadushin@syr.edu, p.singleton@keele.ac.uk
Subject: Re: Launching Prolog from Java
In-Reply-To: <00c501c050b3$41824b80$c6655dc0@greyc.ismra.fr>
Message-ID: <Pine.OSF.4.10.10011171655340.47759-100000@mozart.ebi.ac.uk>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by swi.psy.uva.nl id RAA17530


My stand approach to this is to have
a dummy program that you know to work
to execute the output you expect.
Wrap that for a test.

Maybe plwin does not read from stdin.
You might want to check this as well.

Sorry, I'm not a windows programmer.

Steffen 

On Fri, 17 Nov 2000, Pierre Nugues wrote:

> Dear Steffen, Fred, and Paul,
> 
> Thank you for pointing me to the Process class. It's exactly what I was
> looking for.
> 
> I tried a small code to write and read data from Prolog. I used the Process
> class in a Java program and I wrote a small loop to do I/O that I redirected
> to Prolog using the getInputStream and getOutputStream methods. I wrote a
> symmetrical I/O loop in Prolog using get0/1 read/1 and write/1.
> 
> Java launched the plwin.exe correctly but nothing happened with the I/O.
> Prolog prompts me |: and still attempts to read from the keyboard and
> apparently doesn't receives any data from Java. Something seems to happen
> however when I close Prolog using ^C.
> 
> 
> Do you know why or do you have a complete small code sample. I'm using Win98
> and Plwin.exe
> 
> Many thanks
> Pierre
> --
> Pierre Nugues, Professeur d'informatique (pnugues@greyc.ismra.fr)
> ISMRA, 6, bd du Maréchal Juin, F-14050 Caen, France
> Tél. (33) 231-452-705 -- Fax. (33) 231-452-760
> http://www.ensicaen.ismra.fr/~nugues
> ----- Message d'origine -----
> De : "Fred Dushin" <fadushin@syr.edu>
> À : "Pierre Nugues" <pnugues@greyc.ismra.fr>
> Cc : "Recipients of SWI-Prolog Mailing List" <prolog@swi.psy.uva.nl>
> Envoyé : vendredi 17 novembre 2000 14:51
> Objet : Re: Launching Prolog from Java
> 
> 
> > > I would like to launch SWI-Prolog from Java. I just need to redirect
> > socket
> > > streams to Prolog's standard input and output before launching it. It's
> > > fairly easy to do that with Unix and C with dup() and execv().
> > >
> > > There is an exec() method in Java but apparently it doesn't enable
> > stream
> > > passing.
> > > Is there a workaround?
> >
> > If I understand what you are trying to do, why not just use the
> > get(Input|Output)Stream method on the Process you get back from
> > Runtime.exec()?  With that stream, you can send bytes down the
> > pipe to prolog using the output stream, and you can read the
> > response from prolog by picking bytes off the input stream.
> > You don't need to do any sockets programming for this (though
> > I suppose you could...)
> >
> > > PS I know of JPL. I would like to know whether there is something
> > simpler
> >
> > I've used both the technique described above and (I wrote) JPL.
> > I think using JPL is actually simpler and will generally be more
> > robust.  Streams can be very tempermental.
> >
> >
> > --
> > Fred Dushin <fadushin@syr.edu>
> >
> > vi rulse!^H^H^Hes!
> > `:wq
> >
> 
> 
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
> 
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
> 
> or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe"
> (without the quotes) and *no* message body.
> 
> ** An ARCHIVE of this list is maintained at
> 
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/
> 
> 


    Steffen Moeller <moeller@ebi.ac.uk>    ICQ 37032340

