Pb avec Runtime(urgent)

cs_othland Messages postés 298 Date d'inscription jeudi 18 décembre 2003 Statut Membre Dernière intervention 9 février 2010 - 4 mars 2005 à 15:17
cs_ducheseb Messages postés 344 Date d'inscription mardi 18 mai 2004 Statut Membre Dernière intervention 23 juin 2006 - 7 mars 2005 à 10:39
slt tlm


je veux avoir la fonction suivante:


dès que je clique sur un bouton, une fenetre de interner explorer s'affiche; j'ai mis le code suivant:


if(e.getsource==bouton){Runtime runtime=Runtime.getRuntime();
Process process=runtime.exec("iexplore.exe index.html");
}
lors de la compilation j'ai l'erreur suivante:
unreported exception java.IOException; must be caught or declared to be thrown.
je sais pas quoi faire!!!

1 réponse

cs_ducheseb Messages postés 344 Date d'inscription mardi 18 mai 2004 Statut Membre Dernière intervention 23 juin 2006 9
7 mars 2005 à 10:39
Il faut encadrer to appel d'un bloc Try Catch:

try{

if(e.getsource==bouton){Runtime runtime=Runtime.getRuntime();
Process process=runtime.exec("iexplore.exe index.html");
}
}catch(IOException ioe){System.out.println("Erreur");};
0
Rejoignez-nous