javalinuxprocessfilesystemsumount

How do you force a Linux process (Java webstart App) to stop locking a Filesystem (CD-ROM) WITHOUT killing the process?


In Linux (CentOS 5.4), how do you force a process to stop locking a file system without killing the process?

I am trying to get my Java Webstart Application, running locally, to eject a CD. I do not have this problem if I am just browsing through the files using a JFileChooser, but once I read the contents of a file, I can no longer eject the CD...even after removing ALL references to any files.

Hitting the eject button will give the error (Title - "Cannot Eject Volume"): "An application is preventing the volume 'volume name' from being ejected"

Thus, my goal is to tell the process to stop targeting the CD-ROM in order to free it up.

Thank you for any help or direction!!

Attempted Fix: -running the commands:

sudo umount -l /media/Volume_Name      //-l Lazy Unmount forces the unmount
sudo eject

Problem: When a new CD is inserted, it is no longer mounted automatically probably because the process is still "targeting" it.


Solution

  • Assuming that lsof lists your java application as the only application accessing the file, you might try forcing a garbage collection (using jvisualvm or a similar tool) to see if that frees it up.