2016-08-03 49 views
2

我用下面的在瀏覽器中打開一個URL在Windows上:Java如何在Mac上用命令打開url?

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

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

我應該怎麼做才能實現在Mac上一樣嗎?

回答

3

嘗試open

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

希望這有助於

相關問題