My application contains the following method that will use the Windows File Explorer to open a folder at a given path (validation occurs prior to this method that ensures the path both exists and is a folder)
public int openWindowsFileExplorer(final Path path) {
try {
Runtime.getRuntime().exec("explorer.exe " + path);
} catch (IOException ioException) {
log.error("Could not open directory {}", path, ioException);
return 0;
}
return 1;
}
This works fine when the code is running from within an IDE like IntelliJ. But when I package the application as a JAR then no folder opens and no errors appear in the application’s logs (it’s a Spring Boot application).
I’m assuming it’s a permissions issue of some kind but I’m curious about why no errors appear.
1