read inputstream and use if statement to compare output
<p>I want to read a data stream and everytime it reads a certain word or phrase I want the count to go up. The example I have below fails to count it. I tried looking for "echo percent" as well. All the bat file does is echo percent.</p>

<pre><code>try { 
    String ls_str;
    String percent = "percent";
    Process ls_proc = Runtime.getRuntime().exec("c:\\temp\\percenttest.bat"); 
    // get its output (your input) stream    
    DataInputStream ls_in = new DataInputStream(ls_proc.getInputStream()); 
    while ((ls_str = ls_in.readLine()) != null ) { 
        System.out.println(ls_str);
        progressBar.setValue(progress);
        taskOutput.append(String.format(ls_str+"\n", progress));
        if (ls_str == percent)  {
            progress++;   
        } 
    }
} catch (IOException e1) { 
    System.out.println(e1.toString());                 
    e1.printStackTrace();
}

setProgress(Math.min(progress, 100));   
</code></pre>
