Javaµ÷ÓÃÍⲿ³ÌÐò
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public class CmdTest {
private static final long serialVersionUID = -2650474785662737262L;
public static void main(String[] args) throws Exception {
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("c:\\test.bat");
DealStream errStream = new DealStream(p.getErrorStream(),"Err");
DealStream outStream = new DealStream(p.getInputStream(),"Out");
new Thread(errStream).start();
new Thread(outStream).start();
int exitValue = p.waitFor();
System.out.println("exitValue -- > " + exitValue);
}
}
class DealStream implements Runnable{
private InputStream is;
private String type;
public DealStream(InputStream is,String type){
this.is = is;
this.type = type;
}
public void run(){
try{
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String temp = null;
while((temp = br.readLine()) != null){
System.out.println(type + "-->" + temp
Ïà¹ØÎĵµ£º
¹¹Ôì·½·¨ÕªÒª
Object()
·½·¨ÕªÒª
protected Object clone()
´´½¨²¢·µ»Ø´Ë¶ÔÏóµÄÒ»¸ö¸±±¾¡£
boolean equals(Object obj)
&n ......
±¾×÷Æ·²ÉÓÃ֪ʶ¹²ÏíÊðÃû-·ÇÉÌÒµÐÔʹÓÃ-Ïàͬ·½Ê½¹²Ïí 2.5 Öйú´ó½Ðí¿ÉÐÒé½øÐÐÐí¿É¡£
µ±ÎÒÃÇͨ¹ýJava³ÌÐòÔ±µÄÊÓ½ÇÀ´ä¯ÀÀÍøҳʱ»á·¢ÏÖ£ºÒ»·½ÃæÓû§¶Ëä¯ÀÀÆ÷£¨IE»òFirefox£©ÒÔ±íµ¥»òÁ´½ÓµÄ·½Ê½Ìá½»HTTPÇëÇóͬʱÓÖ´¦ÀíHTTP·þÎñÆ÷·¢³öµÄÏìÓ¦Êý¾Ý£¬½«ÆäÖеÄÊý¾ÝÁ÷£¨HTMLÊý¾Ý»òÆäËüÖÖÀàµÄÊý¾Ý£©ÒÔÊʵ±µÄ·½Ê½Õ¹Ê¾¸øʹÓÃÕßä¯ÀÀ¡ ......
żÏñ³ç°Ý£¨Ò»£©
ÄãµÄżÏñÊÇË£¿ÔÚ¸ßÖÐʱ´ú£¬ÎÒµÄżÏñÊÇÊãÇéÀËÂþ¡¢¸ß¿º¼¤°ºµÄ¿ÕÖв¹¸ø£¨Air Supply£©ÒÔ¼°¾²Èç´¦×Ó¡¢¶¯ÈçÍÑÍõĿÀò·Ã×Â壨Kylie Minogue£©£»ÏÖÔÚÎÒµÄżÏñÊÇDavid Flanagan¡¢Jonathan Knudsen¡¢Elliotte Rusty Harold¡¢Bruce EckelµÈÈË¡£ÄãÎÊÎÒDavid FlanaganµÈÈ˳ª¹ýʲô¸è£¬à¸£¡ÄãÎó»áÁË£¬ËûÃDz» ......
* ------------------------------------------------------------------------------------
Title: TestJava.cpp
author: gloomy fish on 2009-09-16
------------------------------------------------------------------------------------ */
#include <windows.h>
#include <stdio.h& ......