Below is my complete code that I entered in Jmeter BeanShell Sampler.
BufferedReader fileReader = newBufferedReader(new FileReader("F:/url.txt"));
int counter = 1;
content = fileReader.readLine();
while ((nextLine = fileReader.readLine()) != null)
{
content = content + "\n" + nextLine;
counter++;
}
vars.put("content",content);
I am getting below error when I try to execute, I can see this error in log.info
2019-12-02 11:38:01,431 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``BufferedReader fileReader = newBufferedReader(new FileReader("F:/url.txt")); int . . . '' : Typed variable declaration : Command not found: newBufferedReader( java.io.FileReader )
2019-12-02 11:38:01,432 WARN o.a.j.p.j.s.BeanShellSampler: Exception executing script. org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``BufferedReader fileReader = newBufferedReader(new FileReader("F:/url.txt")); int . . . '' : Typed variable declaration : Command not found: newBufferedReader( java.io.FileReader )
I just copy pasted this code from online examples and similarly I tried so many different option to read a file, but it's not working, could someone please help me.
I am using windows machine and jmeter version 5.1