4

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?

2
  • What exactly do you mean by "java interface"? And just to be sure: you're not talking about JavaScript, right? Commented Nov 14, 2009 at 14:49
  • Hi Bart .. via java coding ..yes i am not talking abt java script .. Commented Nov 14, 2009 at 14:52

4 Answers 4

11

You can use the desktop API:

java.awt.Desktop.getDesktop().browse(new URI("http://stackoverflow.com"));

This would launch a browser

Sign up to request clarification or add additional context in comments.

3 Comments

can i use this API to invoke multiple weblinks? ..thats is i have given - stackoverflow.com - i want to invoke with 5 links initially
I guess call the method 5 times?
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?
2

You can do that with Desktop#browse(). It would however only launch the system default configured browser.

Comments

1

See Using the Desktop API in Java SE 6 "Opening the Browser"

Comments

0

You can run the browser executable as a separate process.

Click this link on how to execute an external process in Java.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.