3 Replies Latest reply: Jan 3, 2013 9:58 PM by EJP RSS

    ProcessBuilder Shell Command Output

    837091
      When using ProcessBuilder to execute a shell command, certain output seems to be suppressed, for instance:
      ProcessBuilder pb = new ProcessBuilder("ls", "*.java");
      Process ps = pb.start();
      Scanner in = new Scanner(ps.getInputStream());
      while(in.hasNextLine())
                System.out.println(in.nextLine()); // produces no output
      For some reason, this produces no output, even if there are java files in the current directory. If I remove the argument "*.java", then I will get output such as:
      Main.java
      Main.class
      Other.java
      Other.class

      Any idea why I don't get output from filtering my list?