I have a file named error.log.1
.
I would like to tell Java to use the system editor to open this file.
If it were named error.log
, then the following would work:
Desktop.getDesktop().edit(new File("error.log") );
However, since it is not a recognized file extension, it doesn't open. Instead I get an error:
Exception in thread "main" java.io.IOException: Failed to open error.log.1.
Error message: No application is associated with the specified file for this operation.
at sun.awt.windows.WDesktopPeer.ShellExecute(Unknown Source)
at sun.awt.windows.WDesktopPeer.open(Unknown Source)
at java.awt.Desktop.open(Unknown Source)
at net.joshuad.hypnos.workbench.EditorTest.main(EditorTest.java:9)