[英]Java Application can't write to disk though full permissions are given
I am trying to write to C:\\{foldername}\\batches\\{date}\\batch.csv from a Java application. 我正在尝试从Java应用程序写入C:\\ {文件夹名称} \\ batches \\ {date} \\ batch.csv。 Admin accounts are able to write to the folder, but those without an admin account cannot.
管理员帐户可以写入该文件夹,但是没有管理员帐户的帐户则不能。 The non-admin users have full permissions to write to that folder, creating directories and files as well as updating, and they can do so using Explorer but not the application.
非管理员用户具有写入该文件夹,创建目录和文件以及进行更新的完全权限,他们可以使用Explorer而不是应用程序来执行此操作。 I also have a SQL file that outputs to a similar directory that works just fine under a standard user ever since those users got write permission to that folder.
我还有一个SQL文件,可以输出到类似目录,该目录在标准用户下正常工作,因为这些用户已获得对该文件夹的写许可权。 I assume it is a permissions issue, but they have full permission on the folder.
我认为这是一个权限问题,但他们对该文件夹具有完全权限。 Insight?
有见识?
You can check if the File is writable using the following- 您可以使用以下方法检查文件是否可写:
File f = new File("path");
if(f.canWrite()) {
// write access
} else {
// no write access
}
Try to exclusively make the file writable using the following if it is a permission issue- 如果存在权限问题,请尝试使用以下方法使文件可写:
file.setWritable(false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.