jeudi 15 octobre 2009

une méthode qui ouvre une navigation vers une URL donnée

public void ouvrirPageWeb(String url) {
Properties sys = System.getProperties();
String os = sys.getProperty("os.name");
Runtime r = Runtime.getRuntime();
try {
if (os.endsWith("NT") || os.endsWith("2000") || os.endsWith("XP")) {
r.exec("cmd /c start " + url);
} else {
r.exec("start " + url);
}
} catch (IOException ex) {
System.out.println("ex.printStackTrace()");
}
}

Aucun commentaire:

Enregistrer un commentaire