title: How can I use either Runtime.exec() or ProcessBuilder to open google chrome through its pathname?
body: <p>I am writing a java code that has the purpose of opening a URL on youtube using Google Chrome but I have been unsuccessful in understanding either method. Here is my current attempt at it.</p>
  
  <pre><code>import java.lang.ProcessBuilder;
  import java.util.ArrayList;
  public class processTest
  {
      public static void main(String[] args)
      {
      ArrayList&lt;String&gt; commands = new ArrayList&lt;&gt;();
      commands.add("cd C:/Program Files/Google/Chrome/Application");
      commands.add("chrome.exe youtube.com");
      ProcessBuilder executeCommands = new ProcessBuilder( "C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe", "cd C:/Program Files/Google/Chrome/Application", "chrome.exe youtube.com");
      }
  }
  </code></pre>
  
  <p>It compiles OK, but nothing happens when I run it. What is the deal?</p>