随笔-204  评论-90  文章-8  trackbacks-0
/**
 * 
@author  cnyqiao@hotmail.com
 * @Date   Nov 22, 2006
 
*/

import  java.io. * ;

public   class  compiler  {
    
public  compiler()  {
    }


    
public   static   void  main(String[] args)  {
        compiler compiler1 
=   new  compiler();
        Runtime runtime 
=  Runtime.getRuntime();
        Process process 
=   null ;
        String line 
=   null ;
        InputStream is 
=   null ;
        InputStreamReader isr 
=   null ;
        BufferedReader br 
=   null ;
        
try   {
            process 
=  runtime.exec( " tail -f submit.2006-11-21.log " );  //  关键是这行
        }
  catch  (IOException e)  {
            System.out.println(e);
        }

        is 
=  process.getInputStream();
        isr 
=   new  InputStreamReader(is);
        br 
=   new  BufferedReader(isr);
        
try   {
            
while  ((line  =  br.readLine())  !=   null {
                System.out.println(line);
            }

        }
  catch  (IOException e)  {
            System.out.println(e);
            e.printStackTrace();
        }


    }

}
posted on 2006-11-22 15:09 一凡 阅读(2295) 评论(0)  编辑  收藏 所属分类: JAVA 基础

只有注册用户登录后才能发表评论。


网站导航: