2 Replies Latest reply: Apr 25, 2008 2:41 AM by 807591 RSS

    execute shell script with cygwin

    807591
      Hi,

      I'v been reading this posting [http://forum.java.sun.com/thread.jspa?forumID=31&threadID=699276] about how to achieve running a bash script from a java application, but I didn't get it working. Currently my code is
      @Action(block = Task.BlockingScope.ACTION)
      public void executeTestGenerator() {
           File workDir = new File("c:/cygwin/bin");
              String[] cmdArray = new String[5];
              
           cmdArray[0] = "c:/cygwin/bin/bash";
              cmdArray[1] = "--login";
              cmdArray[2] = "-i";
              cmdArray[3] = "-c";
              cmdArray[4] = "/cygdrive/c/temp/dwhim";
                      
           try {
                Runtime.getRuntime().exec(cmdArray, null, workDir);
                System.out.println("Executing cmd");
           } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
           }
      }
      But nothing happens when I invoke this method. Has anybody an idea how to get this working?