日期:2014-05-20 浏览次数:20698 次
private static final class CompressThread extends Thread {
public void run(){
try {
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("/bin/bash", null, new File("/bin"));
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(process.getOutputStream())), true);
out.println("cd /home/test");
out.println("7za a 201301.zip 201301 -v1m");
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
process.waitFor();
in.close();
out.close();
process.destroy();
} catch (Exception e) {
e.printStackTrace();
}
}
}