title: Selenium Server and Java
body: <p>I'm trying to automate my selenium script by using java.
  The command that I'm trying to execute is: </p>
  
  <pre><code>/usr/bin/java -jar /javalibs/selenium-server/selenium-server-standalone-2.32.0.jar -htmlSuite "*firefox" "http://www.google.com" "/tmp/googlesearchsuite.html" "/tmp/RESUTL.html"
  </code></pre>
  
  <p>That command executes perfectly on my Mac in terminal. Now I want to convert that into Java; here is the code that I'm using for that:</p>
  
  <pre><code>public void localRun() {
  
      Process p = null;
  
      try {
  
          String cmd = "/usr/bin/java -jar /javalibs/selenium-server/selenium-server-standalone-2.32.0.jar -debug -htmlSuite \"*firefox\" \"http://www.google.com\" \"/tmp/googlesearchsuite.html\" \"/tmp/RESUTL.html\"";
  
          System.out.print("COMMAND: " + cmd);
  
          System.out.println();
  
          Runtime runtime = Runtime.getRuntime();
          p = runtime.exec(cmd);
          p.waitFor();
  
          BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
          BufferedReader error = new BufferedReader(new InputStreamReader(p.getErrorStream()));
  
          String line = null;
  
          while ((line = input.readLine()) != null) {
              System.out.println(line);
          }
  
          line = null;
  
          while ((line = error.readLine()) != null) {
              System.out.println(line);
          }
  
          int exitVal = p.waitFor();
  
      } catch (Exception e) {
          System.out.println(e.toString());
          e.printStackTrace();
      } finally {
          p.destroy();
      }
  }
  </code></pre>
  
  <p>When I run that java code I'm getting this log with weird error message (omitting the whole log):</p>
  
  <pre><code>testSuite=/lensoo/googlesearchsuite.html
  COMMAND: /usr/bin/java -jar /javalibs/selenium-server/selenium-server-standalone-2.32.0.jar -debug -htmlSuite "*firefox" "http://www.google.com" "/lensoo/googlesearchsuite.html" "/lensoo/RESUTL.html"
  14:49:55.619 INFO - Java: Apple Inc. 20.45-b01-451
  14:49:55.620 INFO - OS: Mac OS X 10.8.3 x86_64
  14:49:55.630 INFO - v2.32.0, with Core v2.32.0. Built from revision 6c40c18
  14:49:55.631 INFO - Selenium server running in debug mode.
  ......
  14:49:55.790 INFO - Started HttpContext[/wd,/wd]
  14:49:55.801 INFO - Started SocketListener on 0.0.0.0:4444
  14:49:55.801 INFO - Started org.openqa.jetty.jetty.Server@152c7568
  May 3, 2013 2:49:49 PM org.openqa.grid.selenium.GridLauncher main
  INFO: Launching a standalone server
  Can't find HTML Suite file:/Users/maksim/IdeaProjects/CMPE287-TaaS/"/tmp/googlesearchsuite.html":
  Usage: java -jar selenium-server.jar [-interactive] [options]
  
    -port &lt;nnnn&gt;: the port number the selenium server should use
      (default 4444)
    -timeout &lt;nnnn&gt;: an integer number of seconds we should allow a
      clie.......
  </code></pre>
  
  <p>Here is the whole message that I got: <a href="http://pastebin.com/QzHeQ0Bm" rel="nofollow">http://pastebin.com/QzHeQ0Bm</a></p>
  
  <p>Is there any difference between executing command from command line and java? If yes then what will be the proper way to execute that command to run my Selenium HTML Suite.</p>