What it tells you is that you are sending an URL object while it expects an URI.
just change
dt.browse(uri.toURL()); // has error
to
dt.browse(uri); // has error
before being able to use Desktop, you have to consider if it is supported
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
// now enable buttons for actions that are supported.
enableSupportedActions();
}
and the enableSupportedActions
private void enableSupportedActions() {
if (desktop.isSupported(Desktop.Action.BROWSE)) {
txtBrowserURI.setEnabled(true);
btnLaunchBrowser.setEnabled(true);
}
}
that shows that you have to check also, if BROWSE action is also supported.