linux创建文件的获取读写文件权限设置

来源:互联网 发布:微信开发必须80端口 编辑:程序博客网 时间:2024/06/11 22:25

//创建文件
public void createTxt(){
File ct=new File(filetxt);
ct.setWritable(true, false);
ct.setReadable(true, false);
try {
Process process =null;
ct.createNewFile();
/获取LINUX权限的设置
String command1 = “chmod xxx “+ct.getAbsolutePath();
process = Runtime.getRuntime().exec(command1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(“创建文件失败”);
}
}

原创粉丝点击