2012-07-31 38 views
0

我正在運行在碼頭服務器上運行的web應用程序。 在這個應用程序中,我正在上傳圖片並在我的jsp頁面中使用這個圖片。 現在,當我想用​​使用java從jetty服務器刪除文件7

Files.delete(File Path) 

它給了我錯誤

java.nio.file.FileSystemException: "File Path": The process cannot access the file because it is being used by another process. 
+0

你能發表你在哪裏使用該文件嗎? – rtheunissen 2012-07-31 07:07:14

回答

0

關閉與該文件相關聯的所有數據流嘗試刪除它之前將其刪除。考慮將try-with-resources與您上傳的文件一起使用。