开发者

running jar file with multiple arguments in perl

Im trying to run a jar file. this jar file will output multiple question in console manner, i want to eliminate the console and i need to input a value in order to proceed.

e.g :

A. Choose value 1 :

[1] Windows

[2] Unix

Input : 2

B. Choose value 2 :

[1] Oracle

[2] DB2

Input : 1

Im trying :

"java -ja开发者_C百科r 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.

btw, ive also try :

OPEN PIPE, "| java -jar program.jar";

open (FH, /abc.txt)

print PIPE "$res";

close FH;

close PIPE;

Regards


Note sure why your current approach is not working. You may want to take a look at the Expect module on CPAN.


I reckon the entire contents of the file is being piped all at once to the first prompt, so the remainder of the file just gets 'swallowed' and lost

So, +1 to jackrabbit's suggestion of using the Expect module instead

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜