title: exit google chrome using java
body: <p>My question is how can i can exit chrome using java please answer with a imports and package im a beginner :)</p>
  
  <p>i tried: but i know that <code>exec(String command)</code> gets a a specified system command so its wrong there is another way ?</p>
  
  <pre><code>package com.tutorialspoint;
  
  
  public class ProcessDemo  {
  
     public static void main(String[] args) {
  
         String url = "https://www.youtube.com/watch?v=Ei3Vymb_lFM&amp;list=PLqKCUR6vbEfxGeSCePPlk7hH-mpIdqlpg&amp;index=1";
     try {
     // create a new process
     System.out.println("Creating Process...");
     Process p = Runtime.getRuntime().exec(url);
  
     // wait 10 seconds
     System.out.println("Waiting...");
     Thread.sleep(10000);
  
     // kill the process
     p.destroy();
     System.out.println("Process destroyed.");
  
     } catch (Exception ex) {
     ex.printStackTrace();
     }
  
     }
  }
  </code></pre>
  
  <p>the massage i got is
  Creating Process...
  java.io.IOException: Cannot run program "<a href="https://www.youtube.com/watch?v=Ei3Vymb_lFM&amp;list=PLqKCUR6vbEfxGeSCePPlk7hH-mpIdqlpg&amp;index=1" rel="nofollow noreferrer">https://www.youtube.com/watch?v=Ei3Vymb_lFM&amp;list=PLqKCUR6vbEfxGeSCePPlk7hH-mpIdqlpg&amp;index=1</a>": CreateProcess error=2, The system cannot find the file specified
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
      at java.lang.Runtime.exec(Runtime.java:620)
      at java.lang.Runtime.exec(Runtime.java:450)
      at java.lang.Runtime.exec(Runtime.java:347)
      at com.tutorialspoint.ProcessDemo.main(ProcessDemo.java:14)
      at Browser.main(Browser.java:39)
  Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
      at java.lang.ProcessImpl.create(Native Method)
      at java.lang.ProcessImpl.(ProcessImpl.java:386)
      at java.lang.ProcessImpl.start(ProcessImpl.java:137)
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
      ... 5 more</p>