熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

java調用unix服務

2013-11-23 19:06:22  來源: Java核心技術 

  public class UnxiTest {

  public static void main(String arge[]){

  Process process;

  try {

  //process = RuntimegetRuntime()exec(C:\\bat); //在此調用bat文件

  process = RuntimegetRuntime()exec(/opt/OV/b/in/opcmsg sev=critical app=OSSPI obj=error_log msg_text=test Msg node=BL);   //調用服務後面是服務參數

  BufferedReader read = new BufferedReader(new InputStreamReader(

  processgetInputStream()));

  String str = null;

  while ((str = readreadLine()) != null) {

  Systemoutprintln(str);

  }

  } catch (Exception e) {

  //     TODO Autogenerated catch block

  eprintStackTrace();

  }

  Systemoutprintln(sucess);

  }

  }

  //bat 文件 創建目錄test

  @echo a

  MKDIR c:\test


From:http://tw.wingwit.com/Article/program/Java/hx/201311/26284.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.