-4

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.)

1 Answers1

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