The code below does nothing. No file opened, no exception thrown, no output.
What can I do to discover the problem?
It does indeed execute the desktop.open(file) line.
Using JDK 1.16.0_81
File file = new File(pathAndFileString); // an existing text file
if (Desktop.isDesktopSupported()) {
Desktop desktop = Desktop.getDesktop();
if (desktop.isSupported(Desktop.Action.OPEN )) {
try {
desktop.open(file);
} catch (IOException e1) {
e1.printStackTrace();
}
}
else {
System.out.println("Desktop.Action.OPEN not supported");
}
}
else {
System.out.println("Desktop not supported");
}