title: JMeter Bean Shell Sampler error "...Static method get( java.lang.String ) not found in class'java.nio.file.Paths" when copying files
body: <p>I am attempting to copy and rename a file on my local machine (Win 7) using Bean Shell Sampler in JMeter 3.0 (Java v1.8). The idea is to create the new file with a unique name and have the name saved as a variable that can be used in place of the file name in an FTP PUT request.</p>
  
  <p>Here is the code I am using for the copy and rename:</p>
  
  <pre><code>import java.text.*;
  import java.nio.file.StandardCopyOption.*;
  import java.io.IOException;
  import java.nio.file.Files;
  import java.nio.file.Path;
  import java.nio.file.Paths;
  
  String filename = new SimpleDateFormat("dd-MM-yyyy_hh:mm:ss").format(new Date())+".xlsx";
  log.info(filename);
  
  Path source = Paths.get("C:/dropfile/qatp/QATP_GuestRecords.xlsx");
  Path target = Paths.get("C:/dropfile/qatp/"+filename);
  
  Files.copy(source, target, REPLACE_EXISTING);
  </code></pre>
  
  <p>The error I am receiving in the log:</p>
  
  <blockquote>
    <p>ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method:
    eval  Sourced file: inline evaluation of: ``import java.text.<em>; import
    java.nio.file.StandardCopyOption.</em>; import java.io.IO . . . '' : Typed
    variable declaration : Error in method invocation: Static method get(
    java.lang.String ) not found in class'java.nio.file.Paths'</p>
  </blockquote>
  
  <p>I have been searching for an answer to this issue and came across a <a href="https://stackoverflow.com/questions/32202068/jmeter-static-method-get-java-lang-string-not-found-in-classjava-nio-file">solution where the suggestion was</a>:
  "My guess is that the problem is that it's not populating the varargs parameter. Try:</p>
  
  <pre><code>Path target = Paths.get(filename, new String[0]);"
  </code></pre>
  
  <p>I tried this solution by modifying my code like so:</p>
  
  <pre><code>import java.text.*;
  import java.nio.file.StandardCopyOption.*;
  import java.io.IOException;
  import java.nio.file.Files;
  import java.nio.file.Path;
  import java.nio.file.Paths;
  
  String filename = new SimpleDateFormat("dd-MM-yyyy_hh:mm:ss").format(new Date())+".xlsx";
  log.info(filename);
  
  Path source = Paths.get("C:/dropfile/qatp/QATP_GuestRecords.xlsx", new String[0]);
  Path target = Paths.get("C:/dropfile/qatp/"+filename, new String[0]);
  
  Files.copy(source, target, REPLACE_EXISTING);
  </code></pre>
  
  <p>And received this error:</p>
  
  <blockquote>
    <p>ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method:
    eval  Sourced file: inline evaluation of: ``import java.text.<em>; import
    java.nio.file.StandardCopyOption.</em>; import java.io.IO . . . '' : Typed
    variable declaration : Method Invocation Paths.get</p>
  </blockquote>
  
  <p>Does anyone know why I am hitting this error and how to get around it?</p>