当前所在位置:珠峰网资料 >> 计算机 >> 计算机等级考试 >> 正文
计算机二级考试指导:java程序调用命令行
发布时间:2010/3/30 18:32:12 来源:城市学习网 编辑:admin

  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("ERROR");
  while ( (line = br.readLine()) != null)
  System.out.println(line);
  System.out.println("/ERROR");
  int exitVal = proc.waitFor();
  System.out.println("Process exitValue: " + exitVal);
  } catch (Throwable t){
  t.printStackTrace();
  }
  }
  }
  :

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved