1111 - 在线代码运行


            
执行结果

名称:1111

当前代码

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

public class main {
    public static void main(String[] args) throws IOException {
        ProcessBuilder processBuilder = new ProcessBuilder();
        //processBuilder.command("wget","http://wx3.sinaimg.cn/mw690/0060lm7Tly1fyb7zj1bu3j30iw06odg6.jpg");
        //processBuilder.command("service","iptables","status");
        //processBuilder.command("ps","-ef");
        //processBuilder.command("ls","-lh");
        processBuilder.command("cat","/etc/redhat-release");
        //processBuilder.command("kill","-9","17");
        Process process1 = processBuilder.start();

        BufferedReader br1;
        br1 = new BufferedReader(new InputStreamReader(process1.getInputStream(), "utf-8"));
        String line1;
        while ((line1 = br1.readLine()) != null) {
            System.out.println(line1);
        }
    }
}