How to call a browser through Java coding?

I want to call a browser (e.g. Internet Explorer / Firefox / Google Chrome / Opera) through the Java interface. I also need to pass some web links to this Java process. How to achieve this?

+3
source share
4 answers

You can use the desktop API :

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

This will launch the browser

+11
source

You can do this with Desktop#browse(). However, it will only launch the configured default browser.

+2
source
+1

.

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

0
source

Source: https://habr.com/ru/post/1722859/


All Articles