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?
+4
A:
You can use the desktop API:
java.awt.Desktop.getDesktop().browse(new URI("http://stackoverflow.com"));
This would launch a browser
oxbow_lakes
2009-11-14 14:49:09
can i use this API to invoke multiple weblinks? ..thats is i have given - http://stackoverflow.com - i want to invoke with 5 links initially
Sidharth
2009-11-14 14:55:14
I guess call the method 5 times?
oxbow_lakes
2009-11-14 15:01:52
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?
Sidharth
2009-11-14 15:14:20
FYI, for those using Java 5 or earlier: http://www.centerkey.com/java/browser/
Matt Solnit
2009-11-14 19:10:49
+2
A:
You can do that with Desktop#browse()
. It would however only launch the system default configured browser.
BalusC
2009-11-14 14:49:21
A:
You can run the browser executable as a separate process.
Click this link on how to execute an external process in Java.
Pablo Santa Cruz
2009-11-14 14:49:27