Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java - opening URL in internet explorer using java Desktop

I want to know if there is a way to open a webpage specifically in internet explorer using the java Desktop utility. My company uses both firefox and IE, but the url that needs to be open, is only compatible in IE. So, my java class needs to open that url in IE no matter what the default browser is.

Thanks for your help.

like image 917
doka1101 Avatar asked Feb 19 '23 10:02

doka1101


2 Answers

Sure:

Runtime.getRuntime().exec("iexplore.exe www.stackoverflow.com");
like image 68
Tudor Avatar answered Feb 28 '23 02:02

Tudor


This might be late to answer the question, But still I will try to add my 2 cents. The question asked is "How to open URL in internet explorer using java Desktop" The below line of code mentioned in previous answer is correct but it will open in IE only if path is set to it. If there is not path set it will not work and throw error Runtime.getRuntime().exec("iexplore.exe www.stackoverflow.com");

To Force Java open Webpae in IE below is the line of code worked for me even though my default browser is Edge and path for IE is "not" set.

Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore.exe https://carelink.minimed.eu/");

Thanks

like image 23
AnkUser Avatar answered Feb 28 '23 02:02

AnkUser