Tuesday, July 1, 2014

Open a default browser in Window machine through simple java Code

import java.io.IOException;

public class Test {   

    public static void main (String[] args) throws IOException {

        String url = "http://www.google.com";
        Runtime runtime = Runtime.getRuntime();

        runtime.exec("rundll32 url.dll,FileProtocolHandler " + url);
    }

}

No comments:

Post a Comment