This site requires JavaScript, please enable it in your browser!
Greenfoot back
erdelf
erdelf wrote ...

2012/6/22

Call the browser and open links with it.

erdelf erdelf

2012/6/22

#
So I want to open an url with the browser. any idea how to make links working on sites? local it is working. link is a string with the url I used:
        ProcessBuilder pb = new ProcessBuilder();
        String[] cmd = { "cmd", "/C", "start", link };

        pb.command(cmd);
 
        Process p;
        try {
            p = pb.start();
        } catch (IOException e) {}
[/code}
[code]Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler " + link );
if Desktop.isSupported() { Desktop desk = Desktop.getDesktop(); desk.browse(new URI(link)); }
You need to login to post a reply.