简体   繁体   English

NFS驱动器上的Java文件删除

[英]Java file delete on NFS drive

I am trying to delete a file on a NFS drive. 我正在尝试删除NFS驱动器上的文件。

I have had other problems manipulating files on remote drives such as moving a file - however i got around it by not using the conventional method ie renameFile but instead properly using input and output streams. 我在处理远程驱动器上的文件时遇到了其他问题,例如移动文件-但是我通过不使用常规方法(例如,renameFile)来解决该问题,而是正确地使用输入和输出流。

However using the File.delete() returns false , and I have heard suggestions on using the apache commons io FileUtils class - however it just throws an IO exception. 但是,使用File.delete()返回false,并且我听说了有关使用apache commons io FileUtils类的建议-但是它只会引发IO异常。

Does anybody have any suggestions on a way to delete a file on a network mounted drive using java? 有人对使用Java删除网络安装的驱动器上的文件有任何建议吗?

I fixed it. 我修好了它。

I hadnt close a previous buffered reader - meaning the delete couldnt get a lock on the file! 我没有关闭以前的缓冲读取器-意味着删除无法锁定文件!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM