Mark Kennedy
Mark Kennedy

Reputation: 1791

Running perl script within Java

I wanted to run this zipTransfer.pl perl program from within a function in Java

private void runZipTransfer() throws IOException {


Runtime.getRuntime().exec(new String[] {"C:\\Perl64\\bin", "C:\\Lazy\\zipTransfer.pl"});


}

When running my Java program, however, nothing happens! Where's the issue here?

Upvotes: 0

Views: 106

Answers (2)

Steve P.
Steve P.

Reputation: 14709

Try:

Runtime.getRuntime().exec(new String[] {"perl", "C:\\Lazy\\zipTransfer.pl"});

Upvotes: 0

stevenl
stevenl

Reputation: 6798

You need to execute the perl interpreter:

Runtime.getRuntime().exec(new String[] {"C:\\Perl64\\bin\\perl.exe", "C:\\Lazy\\zipTransfer.pl"});

Upvotes: 1

Related Questions