Summary
JDK 6
で導入されたDesktop
を使ってブラウザを起動します。
Screenshot

Advertisement
Source Code Examples
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI(href));
} catch (IOException | URISyntaxException ex) {
ex.printStackTrace();
}
}
View in GitHub: Java, KotlinExplanation
Desktop
を使用することで拡張子に関連付けられたデフォルトのアプリケーションを起動可能OS
毎に対応するアプリケーションをRuntime.getRuntime().exec(String[])
で実行せずにブラウザなどを起動可能