0

How do I use java to execute a perl script. Thanks a bunch :)

Scicare
  • 833
  • 5
  • 13
  • 26
  • possible duplicate of [How should I call a Perl Script in Java?](http://stackoverflow.com/questions/603554/how-should-i-call-a-perl-script-in-java) – Thilo Oct 18 '10 at 01:33

1 Answers1

8

Without knowing any more of the requirements:

Runtime.getRuntime().exec("/path/to/perl /path/to/perl/script");

Documentation about Runtime.exec: http://download.oracle.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String)

wkl
  • 77,184
  • 16
  • 165
  • 176
  • 1
    Adding to answer -- You may want to use newer api -- ProcessBuilder. Passing arguments, processing out/err streams etc are better in this API – Jayan Oct 18 '10 at 08:07