Chinaunix首页 | 论坛 | 博客
  • 博客访问: 64069
  • 博文数量: 27
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 280
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-02 18:53
文章存档

2011年(1)

2009年(7)

2008年(19)

我的朋友

分类: LINUX

2008-08-06 12:44:25


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ExecDemoSort {
  public static void main(String[] av) throws IOException {

    Runtime r = Runtime.getRuntime();

    Process p;

    p = r.exec("sort sortdemo.txt");

    BufferedReader is = new BufferedReader(new InputStreamReader(p
        .getInputStream()));
    System.out.println("Here is your sorted data:");
    String aLine;
    while ((aLine = is.readLine()) != null)
      System.out.println(aLine);
    System.out.println("That is all, folks!");
 
    return;
  }
}
 
阅读(1083) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~