Reputation: 501
I tried to delete a file that I have two of, one slightly changed, so I could delete the older one and replace it with the new one I changed. When I tried to delete the file I got the error message 'file in use' where it said the action can't be completed because the file is open in Java(TM) Platform SE binary.
How do I close it?
Upvotes: 50
Views: 142062
Reputation: 89
-Open Task Manager -Go Details Tab -Find Name=java.exe and CommandLine= your jar path -Right Click -End Task
Example:
Name Command line
javaw.exe "C:\Program Files\Java\jdk-11.0.2\bin\javaw.exe" -jar "C:\TEST\0.0.1-SNAPSHOT.jar"
Upvotes: 1
Reputation: 16656
This is what worked for me (using Windows). It is basically the same procedure as commented by ali haider, but with more details...
Using Windows command prompt:
tasklist | findstr java
("findstr" is a command line utility for Windows similar to "grep" in Linux)
Search for any lines with 'java' and note the PID of the java process.
taskkill /F /PID "PID_OF_JAVA_PROCESS"
where "PID_OF_JAVA_PROCESS" should be replaced with actual PID number.
Result:
SUCCESS: The process with PID "PID_OF_JAVA_PROCESS" has been terminated.
Repeat for each java process that is running. Now you should be able your desired file!
Let me know if you need instructions for Linux (i.e. ps, kill, etc.), but probably most Linux users know these...
Upvotes: 99
Reputation: 93
Upvotes: 3
Reputation: 31
In Windows 8.1:
1) Start Menu...choose "Run" and type: msconfig and click "OK".
2) "System Configuration" opens click the "Startup" tab.
3) Click where it says "Open Task Manager".
4) Choose the "Processes" tab.
5) Look through the list and find "Java SE". Right click and choose "End Task".
6) Close "Task Manager" and "System Configuration" box.
7) Go back to file that could'nt be deleted. Right click and choose "Delete" again. Presto........file deleted.
Upvotes: 3
Reputation: 281
Simply open the task manager on Windows, Check for Processes, Close all the java processes. Now again try deleting the file, you should be able to. This worked for me.
Cheers!
Upvotes: 28
Reputation: 3707
If it's not something that runs during a system boot, try rebooting to clear all open files.
Upvotes: 3