Y a moyen de faire un peu plus simple
pour WIN...
Runtime.getRuntime().exec("cmd /c start http://www.google.com"); ou
Runtime.getRuntime().exec("command /c start http://www.google.com");
simple non ?
Ca marche sous windows 2000, XP, NT mais c'est sur 98 le dexieme uniquement
!
Dominique
|---------+---------------------------------->
| | "Pierre-Yves Varoux" |
| | <[EMAIL PROTECTED]|
| | -online.fr> |
| | |
| | 04/03/2003 09:25 |
| | Please respond to java |
| | |
|---------+---------------------------------->
>-------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: <[EMAIL PROTECTED]>
|
| cc: (bcc: Dominique Gallot/BRU/MASTERCARD)
|
| Subject: RE: Charger un lien ds un navigateur
|
>-------------------------------------------------------------------------------------------------------------------------------|
Salut,
Tu peux soit utiliser un navigateur en pur JAVA, dans ce cas pas de
probl�mes, tu app�le directement ses m�thodes.
Sinon il faut d�velopper une m�thode sp�cifique par syst�me d'exploitation.
Un bout d'exemple sur windows :
[...]
String osname = System.getProperty("os.name").toLowerCase();
boolean ok=true;
if (osname.startsWith("lin")) {ok=false;}
else if (osname.startsWith("mac")) {ok=false;}
else if (osname.startsWith("windows 9")){
try {
Runtime.getRuntime().exec("\"C:\\Program Files\\Internet
Explorer\\IEXPLORE.EXE\" "+adress);
} catch(Exception ee) { ee.printStackTrace(); ok=false; }
}
// win NT
else try {
// essayer : creer un raccourci internet
File shortcut=new File("shortcut.url");
FileOutputStream dataOut = new FileOutputStream(shortcut);
PrintWriter p=new PrintWriter(dataOut);
p.println("[InternetShortcut]");
p.println("URL="+adress);
p.close();
dataOut.close();
// puis lancer ce raccourci
Runtime.getRuntime().exec("cmd /C shortcut.url");
} catch(Exception ee) { System.out.println(ee) ; ee.printStackTrace();
ok=false;}
[...]
C'est empirique, mais �a marche dans la majorit� des cas...
Si quelqu'un poss�de une meilleure solution ...
Pierre-Yves.
> -----Message d'origine-----
> De : hassan [mailto:[EMAIL PROTECTED]
> Envoy� : mardi 4 mars 2003 01:08
> � : [EMAIL PROTECTED]
> Objet : Charger un lien ds un navigateur
>
>
> Bonjour la liste,
> je r�cup�re un lien d'une base de donn�es (de la forme http://www.
> site.com ) et je cherche � le charger dans un navigateur.
> Merci de votre aide.
>
>
>
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************