日期:2014-05-20 浏览次数:20876 次
//可能我人品比较好,一试就成功
import java.io.*;
public class TestRenameTo {
public static void main(String[] args) {
File filea = new File("c:/a.dat");
if (filea.renameTo(new File("c:/a_backup.dat")))
System.out.println("rename successful");
else
System.out.println("rename fail");
try {
Process process = Runtime.getRuntime().exec("cmd ava -version");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
String line = null;
while ((line = bufferedReader.readLine()) != null)
System.out.println(line);
} catch (IOException e) {
e.printStackTrace();
}
}
}