I need to download a file from a java server using socket, and then open it with the default windows program. I've explored for several solution, but none fits perfectly for what I need. The aim is to temporarily open a file with an external default program and then delete the file when the external program exits. I've found these solution:
Desktop.getDesktop.open(MyFile)
, but It seems it can't handle the returned value to check the external program exitProcessBuilder
, it handles the external program exit, but It does not open the "default Windows program", and so I need to check every file extension to run the associated command. This solution is quite "close", but I can't know in advance all types of file to open- Apache Commons Exec, that seems to be the same as 2, more reliable but with the same problem
What to do?