Java如何在Mac上使用命令打开url?

时间:2016-08-03 21:50:24

标签: java macos url command

我使用以下命令在Windows上的浏览器中打开网址:

Command="C:\\Program Files\\Internet Explorer\\IEXPLORE "+Url;

Process Child=Runtime.getRuntime().exec(Command);

我应该怎么做才能在Mac上实现同样的目标?

1 个答案:

答案 0 :(得分:3)

尝试open

String Command="open "+"http://google.ca";
Process Child=Runtime.getRuntime().exec(Command);

希望这有帮助