Taking Perl input from a java app

Taking Perl input from a java app

am 03.08.2006 22:21:25 von bluesteelUT

Hey everyone here is my problem,

I have a Java Program that will wait for user input, and then execute
the command that they put in. What i want to be able to do it automate
the process and write perl scripts to not only startup the java app,
but also to pump it full of commands and also read the output of the
commands once they have been run.

So here is the way i see it in my head working.

The perl script runs the app until the app asks for some input.
The perl script gives it input and waits while the java app processes
the input.
Once the java app finishes, it will output some info that i would like
to read in.
Then the java app will prompt again for more input.
So the perl script gives it more...and so forth until i exit.

I am not clear how to pass the input to the java app when it wants it,
and how to make the perl script wait while the processes it.

Any pointers would help out a lot. (I am running it all on Windows)

Thanks,
Bryan Campbell

Re: Taking Perl input from a java app

am 03.08.2006 23:27:34 von mgarrish

bluesteelUT@gmail.com wrote:

> Hey everyone here is my problem,
>
> I have a Java Program that will wait for user input, and then execute
> the command that they put in. What i want to be able to do it automate
> the process and write perl scripts to not only startup the java app,
> but also to pump it full of commands and also read the output of the
> commands once they have been run.
>

Have you had a look at perlipc? In particular, see the section on
bidirectional communication

http://search.cpan.org/~nwclark/perl-5.8.8/pod/perlipc.pod#B idirectional_Communication_with_Another_Process

Re: Taking Perl input from a java app

am 05.08.2006 03:09:56 von code_wrong

wrote in message
news:1154636485.906128.163310@m73g2000cwd.googlegroups.com.. .
> Hey everyone here is my problem,
>
> I have a Java Program that will wait for user input, and then execute
> the command that they put in. What i want to be able to do it automate
> the process and write perl scripts to not only startup the java app,
> but also to pump it full of commands and also read the output of the
> commands once they have been run.
>
> So here is the way i see it in my head working.
>
> The perl script runs the app until the app asks for some input.
> The perl script gives it input and waits while the java app processes
> the input.
> Once the java app finishes, it will output some info that i would like
> to read in.
> Then the java app will prompt again for more input.
> So the perl script gives it more...and so forth until i exit.
>
> I am not clear how to pass the input to the java app when it wants it,
> and how to make the perl script wait while the processes it.
>
> Any pointers would help out a lot. (I am running it all on Windows)

This may not be exactly what you want, but it demonstrates (with source
code) a Java applet communicating with a Perl script.
http://www2.sys-con.com/ITSG/VirtualCD_Spring05/Java/archive s/0303/dibella/index.html