-1

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.

3
  • 3
    Please stop calling it "JAVA" - it's not an acronym, the programming language is called "Java". Commented Sep 14, 2009 at 9:26
  • 2
    "JAVA" is almost as annoying as people saying "PERL" Commented Sep 14, 2009 at 13:19
  • 3
    I thought JAVA was a recursive acronym that makes reference to the virtual machine: Java Ain't a Vacuum-tube Appliance. ;) Commented Sep 14, 2009 at 18:41

1 Answer 1

9

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.