Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Java application to open browser tabs

Tags:

java

macos

I am thinking to make a java application that will take as an input different URLS and open them automatically on new browser tabs.I do know how to make it work up to the point where a tab is opened .Is that process something too complicated ? What should i look to in order to learn how to do it ?Thanks for any help.

Note this is for OSX

like image 407
Giannis Avatar asked Jun 21 '26 09:06

Giannis


2 Answers

You can use Runtime.getRuntime().exec() to invoke any command from the Java application. In your case it can be the browser.

Here is the javadoc

like image 145
lobster1234 Avatar answered Jun 23 '26 22:06

lobster1234


To handle this in a somewhat OS independent manner, you could try Desktop.browse(URI). But the requirement of all URI's in the same tab can't be done this way, AFAIK.

like image 26
Bart Kiers Avatar answered Jun 24 '26 00:06

Bart Kiers