title: Retrieve a value from program arguments on eclipse
body: <p>I want to set up a main class that pass a string to another class from the prompt dialog on Eclipse.</p>
  
  <p>So I set up a Program argument on "Run Configurations" as a ${string_prompt} variable. When I run my program the input dialog appear and I input a value.</p>
  
  <p>I then retrieve the input on my main class from the index 0 of the String[] args argument:</p>
  
  <pre><code>if ( args.length &gt; 0 ) {b = new BrowserHandler(args[0]);}
  </code></pre>
  
  <p>and pass it to my BrowserHandler class constructor, that retrieve it and set the String as the input value.</p>
  
  <p>I successively try to call a method named SetBrowser() from the main class. It has to check the validity of the aforementioned String:</p>
  
  <pre><code>    public static void main(String[] args) throws Exception {
  
          BrowserHandler b;
  
          if ( args.length &gt; 0 ) {b = new BrowserHandler(args[0]);}
          else b = new BrowserHandler();
  
          b.setBrowser();
          if ( !b.valid ) System.out.println("Browser not valid");
  
          else {
              //do something
          }
  
      }
  
  }
  </code></pre>
  
  <p>The BrowserHandler class:</p>
  
  <pre><code>public class BrowserHandler {
  
  public String browser;
  Boolean valid = true;
  
  public BrowserHandler(String browser){
      this.browser = browser.toLowerCase();
  }
  
  public void setBrowser() {
          if ( this.browser == "firefox" ) { 
              System.out.println("...setting firefox");
              this.driver = new FirefoxDriver(); 
          }
          else valid = false;
  
  }
  </code></pre>
  
  <p>The problem is that the String browser of the browserhandler class get the variable, but when it comes to check the value of the string it always fails the condition, setting valid to false.</p>
  
  <p>I cannot figure it why is that, despite having tried to debug it.
  Any suggestion that could lead me to the reason of it?   </p>