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);