---RP.java-------------------------------------------------------------------------
import java.io.*;
class RP extends Thread {
public static void main(String argv[])
{
RP k=new RP();
k.start();
}
public void run(){
try{
byte[] b = new byte[2048];
int count = 0;
InputStream is = null;
InputStream err = null;
Runtime runt = Runtime.getRuntime();
Process p = runt.exec("notepad rp.java");
Process pww = runt.exec("notepad rp.java ");
Process pw = runt.exec("notepad rp.java ");
is = p.getInputStream();
err = p.getErrorStream ();
while((count = is.read(b, 0, b.length)) != -1) {
System.out.print(new String(b, 0, count));
}
System.out.println("");
while((count = err.read(b, 0, b.length)) != -1) {
System.out.println("== err ==> " + new String(b, 0, count));
}
System.out.println("");
}catch(IOException ioe){
System.out.println(ioe);
System.out.println("실행중 에러 발생.. ");
}
}
}
댓글 없음:
댓글 쓰기