Example usage for java.lang ProcessBuilder start

List of usage examples for java.lang ProcessBuilder start

Introduction

In this page you can find the example usage for java.lang ProcessBuilder start.

Prototype

public Process start() throws IOException 

Source Link

Document

Starts a new process using the attributes of this process builder.

Usage

From source file:MainClass.java

public static void main(String args[]) throws IOException {

    ProcessBuilder proc = new ProcessBuilder("notepad.exe", "testfile");
    proc.start();
}

From source file:MainClass.java

public static void main(String args[]) {

    try {/*w w  w . ja va2  s .  co  m*/
        ProcessBuilder proc = new ProcessBuilder("notepad.exe", "testfile");
        proc.start();
    } catch (Exception e) {
        System.out.println("Error executing notepad.");
    }
}

From source file:MainClass.java

public static void main(String args[]) {

    try {//from   w  w  w.  j  a va 2 s .c  o  m
        ProcessBuilder proc = new ProcessBuilder("notepad.exe testfile");
        proc.start();
    } catch (Exception e) {
        System.out.println("Error executing notepad.");
    }
}

From source file:Main.java

public static void main(String[] args) {

    // create a new list of arguments for our process
    String[] list = { "notepad.exe", "test.txt" };

    // create the process builder
    ProcessBuilder pb = new ProcessBuilder(list);
    try {//from w  w w. j  a  v  a  2  s  .  c  o m

        pb.start();
        System.out.println(pb.redirectInput());
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static void main(String[] args) {

    // create a new list of arguments for our process
    String[] list = { "notepad.exe", "test.txt" };

    // create the process builder
    ProcessBuilder pb = new ProcessBuilder(list);
    try {/*from w  w w . j  a va 2 s  .  co m*/

        pb.start();
        System.out.println(pb.redirectOutput());
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static void main(String[] args) {

    // create a new list of arguments for our process
    String[] list = { "notepad.exe", "test.txt" };

    // create the process builder
    ProcessBuilder pb = new ProcessBuilder(list);
    try {// w  w w .  j  ava 2 s .  c o  m

        pb = pb.redirectError(new File("c:/"));
        pb.start();
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static void main(String[] args) {

    // create a new list of arguments for our process
    String[] list = { "notepad.exe", "test.txt" };

    // create the process builder
    ProcessBuilder pb = new ProcessBuilder(list);
    try {/*from w ww. j  a va  2  s.  c o  m*/

        pb = pb.redirectInput(new File("c:/"));
        pb.start();
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static void main(String[] args) {

    // create a new list of arguments for our process
    String[] list = { "notepad.exe", "test.txt" };

    // create the process builder
    ProcessBuilder pb = new ProcessBuilder(list);
    try {/*from   w  w  w  . ja  va  2  s. com*/

        pb = pb.redirectOutput(new File("c:/"));
        pb.start();
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static void main(String[] args) {

    // create a new list of arguments for our process
    String[] list = { "notepad.exe", "test.txt" };

    // create the process builder
    ProcessBuilder pb = new ProcessBuilder(list);
    try {//ww  w .  j a va2s. c  o  m

        ProcessBuilder.Redirect re = pb.redirectError();
        pb.start();
        System.out.println(re);
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static void main(String[] args) {

    // create a new list of arguments for our process
    String[] list = { "notepad.exe", "test.txt" };

    // create the process builder
    ProcessBuilder pb = new ProcessBuilder(list);
    try {/*from   ww w  .  j  av a  2  s.c  om*/

        pb = pb.redirectError(ProcessBuilder.Redirect.from(new File("c:/")));
        pb.start();

    } catch (IOException ex) {
        ex.printStackTrace();
    }
}