在linux中执行平台相关runtime.exec()

/*
 * @(#) Exec.java Feb 28, 2011 10:14:16 AM
 *
 * Rockwell Automation PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ExecModified
{
 public static void main(String[] args)
 {
      try
 {  

String cmd[] ={"/bin/sh","-c","sqlldr"};
  Process pro = Runtime.getRuntime().exec(cmd);
  try
  {
   pro.waitFor();
  }
  catch (InterruptedException e)
  {
   e.printStackTrace();
  }
  BufferedReader  br = new BufferedReader(new InputStreamReader(pro.getInputStream()));
  String content = "" ;
  while((content = br.readLine())!=null)
  {
   System.out.println(content);
  }
 }
 catch (IOException e)
 {
  e.printStackTrace();
 }
 }
}

你可能感兴趣的:(java,C++,c,linux,C#)