简体   繁体   English

尽管已授予完全权限,但Java应用程序无法写入磁盘

[英]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.

相关问题 Windows 7上的Java App无法在磁盘上写,为什么? - Java App can't write on disk on Windows 7, why? Android 文件系统 - 即使我有权限也无法写入文件 - Android File System - Can't write on file even though I have permissions 如何获得具有写权限的Java中的原始磁盘访问-Windows 7 - How to get raw disk access in Java with write permissions - Windows 7 使用Java Nio进行写操作期间如何检测磁盘已满? - How to detect disk full during write operation with Java nio? 如何限制Java应用程序的读写权限 - How to restrict read and write permissions of Java Application java mysql磁盘已满 - java mysql disk full 我作为服务运行的Java应用程序在Windows 2008上导致磁盘已满错误。从资源管理器中看不到任何内容 - My java application running as a service is causing disk full error on windows 2008. Ca't see anything from the explorer 即使给定了读/写权限,也无法从外部存储读取或创建文件 - Failure to read or create a file from external storage even though given read/write permissions 无法写入具有权限的SD卡 - Can't write to SD Card with permissions 如果在本地主机上执行,自签名的Java Applet可以具有完全权限吗? - Can a self signed Java Applet have full permissions if executed on the localhost?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM