Is it possible to write a program in java that allows you to type something like "Can you go to google?" and then have the program open your default webbrowser and go to google?
Asked
Active
Viewed 58 times
-2
-
1possible duplicate of [How to open the default webbrowser using java](http://stackoverflow.com/questions/5226212/how-to-open-the-default-webbrowser-using-java) – trogdor Mar 15 '14 at 15:50
-
1Perfect answer to this question: Yes. – Tobias Mar 15 '14 at 15:50
2 Answers
1
Yes, it is possible, using the Desktop API.
The Desktop class allows a Java application to launch associated applications registered on the native desktop to handle a URI or a file.
Supported operations include:
- launching the user-default browser to show a specified URI;
- launching the user-default mail client with an optional mailto URI;
- launching a registered application to open, edit or print a specified file.

JB Nizet
- 678,734
- 91
- 1,224
- 1,255
1
You can open the webpage with your default browser with the following:
Desktop.getDesktop().browse(new URI("www.google.ca"));
Dont forget to import java.awt.Desktop :)

red-goblin
- 41
- 3