From: Kulit Ko on
Hi All,
Im trying to run a jar file. this jar file will output multiple
question in console manner and i need to input a value in order to
proceed.
e.g :
A. Choose value 1 :
1 Windows
2 Unix
Input : 2 <Enter>
B. Choose value 2 :
1 Oracle
2 DB2
Im trying :
"java -jar program.jar < abc.txt"
where abc.txt has a value of :
2
1
3
etc.
but its not working its only getting the first value. please help.
thanks.
From: Kulit Ko on
btw, ive also try :
OPEN PIPE, "|java -jar program.jar";
open FH, /abc.txt
while (my $res = <FH>)
print PIPE "$res";
close FH;
close PIPE;
From: Xho Jingleheimerschmidt on
Kulit Ko wrote:
> btw, ive also try :
> OPEN PIPE, "|java -jar program.jar";
> open FH, /abc.txt
> while (my $res = <FH>)
> print PIPE "$res";
> close FH;
> close PIPE;

You should check to see if your "open" succeeds.
Getting the syntax right would also help,

Search pattern not terminated at <something> line 2

Does your Java program want to talk directly with a tty, rather than an
ordinary stream?

Xho
From: Ted Zlatanov on
On Sat, 29 May 2010 16:10:53 -0700 Xho Jingleheimerschmidt <xhoster(a)gmail.com> wrote:

XJ> Kulit Ko wrote:
>> btw, ive also try :
>> OPEN PIPE, "|java -jar program.jar";
>> open FH, /abc.txt
>> while (my $res = <FH>)
>> print PIPE "$res";
>> close FH;
>> close PIPE;

XJ> You should check to see if your "open" succeeds.
XJ> Getting the syntax right would also help,

XJ> Search pattern not terminated at <something> line 2

XJ> Does your Java program want to talk directly with a tty, rather than
XJ> an ordinary stream?

.... and if it does, look into the Expect module :)

Ted