Just a quick question. Part of a program I'm building with Java opens up Chrome. I was wondering if after the program opened Chrome, there would be a way to search a specific URL or just regular keywords (example: recipes, images, or to just Google a question.)
Asked
Active
Viewed 871 times
-4
-
Check this [example](http://stackoverflow.com/a/18509384/364474) – bprasanna Dec 05 '14 at 20:10
1 Answers
0
You can this code below.But this will only work on Windows
String question="what is this?";
question= question.replace(' ', '+');
try {
Runtime.getRuntime().exec(new String[]{"cmd", "/c","start chrome https://www.google.com/search?q="+question});
} catch (Exception e) {
}

Muhammet Ali Asan
- 1,486
- 22
- 39