/**
  *
  * @param command
  *     ex> "java -jar jface/util/tool/trang.jar D:\\runtest\\tableconfig.xml D:\\runtest\\TableConfig.xsd"
  */
 public void launcher(String command) {
 
  try {
   String s;
   String error = "";
  
   Process process = new ProcessBuilder("cmd", "/c", command).start();
  
   // 외부 프로그램 출력 읽기
      BufferedReader stdOut   =
       new BufferedReader(new InputStreamReader(process.getInputStream()));
      BufferedReader stdError =
       new BufferedReader(new InputStreamReader(process.getErrorStream()));
 
      // "표준 출력"과 "표준 에러 출력"을 출력
      while ((s =   stdOut.readLine()) != null) {
       System.out.print(s);
      }
      while ((s = stdError.readLine()) != null) {
       error = error + s;      
      }
 
      if(process.exitValue() == 0) {
       MessageDialog.openInformation(parent.getParent().getShell(),
         "XSD generate", parent.getXsdLocationText().getText() + " 를 생성했습니다.");
      } else {
       MessageDialog.openInformation(parent.getParent().getShell(),
         "XSD generate", error + "\n\n" + parent.getXsdLocationText().getText() + " 생성에 실패했습니다.");
      }

  } catch(Exception e) {
   e.printStackTrace();
  }
 }

'java > util' 카테고리의 다른 글

[java] - base54 String decode  (0) 2010.06.30
[java] - 타입 변환  (0) 2010.06.30
[java] - byte array to int  (0) 2010.06.29
[java] - int to byte array  (0) 2010.06.29
[java] - Big Endian to Little Endian  (0) 2010.06.29
Posted by 짱가쟁이