请达人指点
package 进程间的通信;
import java.io.*;
public class MainProcess implements Runnable{
Process p=null;
/** Creates a new instance of MainProcess */
public MainProcess()
{
//new Thread(this).start();
try
{
p=Runtime.getRuntime().exec( "java ChildProcess ");
}
catch(Exception e)
{
e.printStackTrace();
}
new Thread(this).start();
}
public void run()
{
InputStream ism=p.getInputStream();
BufferedReader br=new BufferedReader(new InputStreamReader(ism));
try
{
while(true)
{
String str=br.readLine();
System.out.println(str+ ": ");
}
// br.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String args[])
{
MainProcess mp=new MainProcess();
}
}
//下面是子进程代码
package 进程间的通信;
import java.io.*;
public class ChildProcess {
/** Creates a new instance of ProcessTest */
public static void main (String args[])
{
while(true)
{