tags:

views:

209

answers:

2

Possible duplicates:


I want to execute a program of Perl from Java.

I take a file name with an argument and carry out a program, and the program of Perl outputs a result file.

So it is the program side of the JAVA

  1. I appoint an argument and carry out Perl program
  2. Perl program reads the file which I spitted out

2) checks the existence of the file and seems to be able to do it, but will 1) be possible? ActivePerl is installed with the present machine. I develop Java on Eclipse.

+10  A: 

Use:

String command = "ls";    
Runtime.getRuntime().exec(command);

Reference:Executing a Command

FYI: The link contains examples of commands with arguments, and with spaces too.

OMG Ponies
A: 

This article explains it rather well.

Bart J
JPL has been deprecated. It is not in Perl 5.10. Don't use it. Use Inline::Java instead.
daotoad