1

I just finished a project with Python and now I am trying to convert it into Java. I have a lot of things done but I am stuck on this one part. In python, I am opening a random link from a list on the web browser with this code

import webbrowser

urls = [# list of URLs]
url_to_open = random.choice(urls)
webbrowser.open(url_to_open)

In Java I was able to replicate the choosing of the random URL, but I am not sure how to open the URL in the web browser.

So, what is the Java equivalent to Python webbrowser.open()?

michaelpri
  • 3,521
  • 4
  • 30
  • 46
  • Google and ye shall receive: [How to open the default webbrowser using java](http://stackoverflow.com/questions/5226212/how-to-open-the-default-webbrowser-using-java) – tnw Feb 17 '15 at 15:39

1 Answers1

2

java.awt.Desktop.browse(URI) has this facility.

Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265