:::: MENU ::::

Running UNIX commands in your Java application

I was looking around for a method to run commands from the prompt automatically from within my Java application, and then I found it. Here’s the solution – and it works like a charm!

static void doExec1() throws IOException {

// use pipes and I/O redirection
// but without using a shell

Runtime runtime = Runtime.getRuntime();
runtime.exec(“ls | wc >out1″);
}

Similar Posts:


So, what do you think ?

  • *