吴旭晓个人博客 繁体中文 简体中文

首页| 日志 |JAVA |ASP |PHP |Android |IOS |ASP.NET |JavaScript |DIV+CSS |SEO |taobaoke |饼哥语录
繁体中文 简体中文

Java 程序调用命令行代码介绍

package test;
  import java.util.*;
  import java.io.*;
  public class MediocreExecJavac
  {
  public static void main(String args[])
  {
  try
  {
  Runtime rt = Runtime.getRuntime();
  Process proc = rt.exec("C:\\Program Files\\FOUNDER\\方正飞腾集成排版系统4.1\\Fit.exe");
  InputStream stderr = proc.getErrorStream();
  InputStreamReader isr = new InputStreamReader(stderr);
  BufferedReader br = new BufferedReader(isr);
  String line = null;
  System.out.println("");
  while ( (line = br.readLine()) != null)
  System.out.println(line);
  System.out.println("");
  int exitVal = proc.waitFor();
  System.out.println("Process exitValue: " + exitVal);
  } catch (Throwable t){
  t.printStackTrace();
  }
  }
  }

作者:吴旭晓 | 来源:个人博客 | 点击量:1729 | 发布时间:2013-06-24
最新留言 | 返回上一页 | 返回首页

相关文章:

版权所有:吴旭晓个人博客 Copyright © 2013-2023 个人博客