How should I call a Perl Script in Java?

后端 未结 4 1189
逝去的感伤
逝去的感伤 2020-11-29 08:52

I read Runtime.getRuntime().exec(\"perl script.pl\") is an option, but is this the best way to do it?

I\'ll need an answer from that script, so I\'ll ha

4条回答
  •  难免孤独
    2020-11-29 09:16

    You can use Runtime.getRuntime().exec() or use the Process API. The Process API allows you to get the output of the script, so you can have both communicate.

    exitValue() and getInputStream() seems to be what you need.

提交回复
热议问题