0

So i need to run an exe file in background for my application. i am using

try
{
    Runtime r = Runtime.getRuntime();
    Process p2 = r.exec("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"); //absolute or relative path
    r.exec("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", false);
} catch (IOException e) {          
    e.printStackTrace();
}  

but the application runs in foreground

What should I do to make it run in background.

edit: I would like to run chrome in background (i am a noob) I have no idea how to use a thread)

  • How do you run **anything** in the background in Java? You use threads. Please Google a Java thread tutorial for the details. – Hovercraft Full Of Eels Jun 17 '17 at 14:40
  • When you say "run in background", do you mean you want chrome to run invisibly? Your code is executing another Windows program, so please define **background**. Better, tell us what you want to do with chrome in the background - as is, this seems like an [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). – Elliott Frisch Jun 17 '17 at 14:42

0 Answers0