Filefile=newFile("WebRoot\test.html");
BufferedReaderbufferedReader=
newBufferedReader(newInputStreamReader(newFileInputStream(file)));
Stringrow=null;
StringBuffersb=newStringBuffer();
while((row=bufferedReader.readLine())!=null){
System.out.println(row);
sb.append(row);
}
bufferedReader.close();
㈡ 如何用java打開一個本地文件
上代碼
String[]cmd=newString[]{
"cmd.exe",
"/c",
//第三個參數就是你要打開的文件路徑
"D:\Work\workspace\GIFRecorder.rar"
};
Runtime.getRuntime().exec(cmd);