java - open url in chrome browser only


Question

I have an url, I am trying to open that url in web view of JavaFX but the content was not compatible with web view. It's only compatible to the chrome and firefox. So I would like to open that Url in chrome browser only instead of opening it in web view. is it possible?(I don't want to open it in default browser.)

I tried the below code but we got the error as "Cannot run program "chrome": error=2, No such file or directory".

Runtime.getRuntime().exec(new String[] { "Chrome", "http://goo.gl/EsomR0" });      

thanks,

1
5
6/16/2014 8:10:09 AM

Runtime.getRuntime().exec(new String[]{"cmd", "/c","start chrome http://goo.gl/EsomR0"});

This worked for me.

-- Edit: Only worked on Windows

9
6/16/2014 10:10:10 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon