I want to invoke a browser (e.g. Internet Explorer/Firefox/Google Chrome/Opera) via a Java interface. Also I need to pass some web links to this Java process. How to achieve this?
-
What exactly do you mean by "java interface"? And just to be sure: you're not talking about JavaScript, right?Bart Kiers– Bart Kiers2009-11-14 14:49:10 +00:00Commented Nov 14, 2009 at 14:49
-
Hi Bart .. via java coding ..yes i am not talking abt java script ..Sidharth– Sidharth2009-11-14 14:52:44 +00:00Commented Nov 14, 2009 at 14:52
Add a comment
|
4 Answers
You can use the desktop API:
java.awt.Desktop.getDesktop().browse(new URI("http://stackoverflow.com"));
This would launch a browser
3 Comments
Sidharth
can i use this API to invoke multiple weblinks? ..thats is i have given - stackoverflow.com - i want to invoke with 5 links initially
oxbow_lakes
I guess call the method 5 times?
Sidharth
but it will open a separate browser for each call ... but i want to open in the same browser with tabs . how to achieve this?
You can do that with Desktop#browse(). It would however only launch the system default configured browser.
Comments
You can run the browser executable as a separate process.
Click this link on how to execute an external process in Java.