title: JMeter Beanshell Postprocessor : Reading a file
body: <p>I am using the below script in a Beanshell Postprocessor</p>
  <pre><code>import java.io.*;
  File f =new File (&quot;C:\Users\xxxxx\Desktop\testresults.csv&quot;);
  FileWriter fw=new FileWriter(f,true);
  BufferedWriter bw=new BufferedWriter(fw);
  
  var r=prev.getResponseCode();
  
  if (r.equals(&quot;200&quot;))
  
  {
      bw.write(&quot;Test Passed&quot;);
      }
  
      else
      {
          bw.write(&quot;Test failed&quot;);
          }
  bw.close();
  fw.close();
  </code></pre>
  <p>But I am getting the below error
  BeanShellInterpreter: Error invoking bsh method: eval   Sourced file: inline evaluation of: ``import java.io.*; File f =new File (&quot;C:\Users\xxxxx\Desktop\testresults.csv&quot;) . . . '' Token Parsing Error: Lexical error at line 2, column 23.  Encountered: &quot;U&quot; (85), after : &quot;&quot;C:\&quot;.</p>
  <p>What could cause the above error.</p>