Otwieranie adresu URL z Java

piszemy sterownik jdbc o otwartym kodzie źródłowym dla bigquery i napotkaliśmy następujący problem:

Chcemy autoryzować nasz sterownik Oauth 2 jako zainstalowaną aplikacją. Na Windows XP, Windows 7 x64, Windows 7 x64 + RDP działa poprawnie. Ale na testbench, który jest serwerem Windows Server 2008 R2 + RDP, kończy się niepowodzeniem.

Zasadniczo otwieramy przeglądarkę internetową, loguje się, łapiemy odpowiedź i uwierzytelniamy użytkownika.

Oto kod otwarcia adresu URL:

    private static void browse(String url) {
    // first try the Java Desktop
    logger.debug("First try the Java Desktop");
    if (Desktop.isDesktopSupported()) {
        Desktop desktop = Desktop.getDesktop();
        if (desktop.isSupported(Action.BROWSE))
            try {
                desktop.browse(URI.create(url));
                return;
            } catch (IOException e) {
                // handled below
            }
    }
    // Next try rundll32 (only works on Windows)
    logger.debug("Try the rundll32");
    try {
        Runtime.getRuntime().exec(
                "rundll32 url.dll,FileProtocolHandler " + url);
        return;
    } catch (IOException e) {
        // handled below
    }
    // Next try browsers
    logger.debug("Try with browsers");
    BareBonesBrowserLaunch.openURL(url);
}

Zorientowałem się, że: BareBonesBrowserLaunch nie otwiera linku ani FileProtocolHandler.

Długość adresu URL jest nieco poniżej 250 znaków.

Każda pomoc byłaby mile widziana!

questionAnswers(3)

yourAnswerToTheQuestion