public boolean savedblog(String log) { //---------直接保存
try {
FileWriter fw = new FileWriter( "../lizhi/log.txt ", true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write( "122222222\r\n ");
bw.close();
fw.close();
return true;
}
catch (IOException e) {
e.printStackTrace();
}
return false;
}
}
这样在WINDOWSXP下运行是没有问题的,开始放在linux下就报异常,为什么呀 ?要怎么改?谢谢!!
------解决方案--------------------
new FileWriter( "../lizhi/log.txt ", true);
你对父目录和lizhi目录有写权限吗?