Skip to content

Commit 30df47b

Browse files
authored
Merge pull request #2 from panovr/fix-win10-browser-open-issue
Fix Windows default browser open issue
2 parents 4ab06c9 + fe3b580 commit 30df47b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/main/java/org/scijava/plugins/platforms/windows/WindowsPlatform.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,18 @@ public String osName() {
5555
@Override
5656
public void open(final URL url) throws IOException {
5757
final String cmd;
58+
final String arg;
59+
// NB: the cmd and arg separate is necessary for Windows OS
60+
// to open the default browser correctly.
5861
if (System.getProperty("os.name").startsWith("Windows 2000")) {
59-
cmd = "rundll32 shell32.dll,ShellExec_RunDLL";
62+
cmd = "rundll32";
63+
arg = "shell32.dll,ShellExec_RunDLL";
6064
}
61-
else cmd = "rundll32 url.dll,FileProtocolHandler";
62-
if (getPlatformService().exec(cmd, url.toString()) != 0) {
65+
else {
66+
cmd = "rundll32";
67+
arg = "url.dll,FileProtocolHandler";
68+
}
69+
if (getPlatformService().exec(cmd, arg, url.toString()) != 0) {
6370
throw new IOException("Could not open " + url);
6471
}
6572
}

0 commit comments

Comments
 (0)