2

I have a scenario where i have used to open a file using the java commands in following steps

a) creating File object for the location of file

File f = new File(filePath);

b) then using system application (like Excel) to open the file

Desktop desktop = null;
if (Desktop.isDesktopSupported()) {
    desktop = Desktop.getDesktop();
}
try {
    desktop.open(f);
} catch (IOException e) {
}

Now I want to get informed in the program when this file is closed by the window application. Is there any mechanism to know whether the opened file is still open or closed by the application?

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
chaitu
  • 1,036
  • 5
  • 20
  • 39
  • 4
    possible duplicate of [Java: Check if file is already open](http://stackoverflow.com/questions/1390592/java-check-if-file-is-already-open) – Dante May Code Nov 27 '12 at 04:40

1 Answers1

0

I doubt whether you will get a definite solution for this.

you can look at this thread

Java: Check if file is already open

The main problem is, the fileLock is dependent on file system of the OS.

Community
  • 1
  • 1
Debobroto Das
  • 834
  • 6
  • 16