running jar file with multiple arguments in perl

K

Kulit Ko

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.
 
K

Kulit Ko

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;
 
X

Xho Jingleheimerschmidt

Kulit said:
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
 
T

Ted Zlatanov

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top