私のローカルのファイルをコピーして名前を変更しようとしていますJMeter 3.0(Java v1.8)のBean Shell Samplerを使用して、マシン(Win 7)を起動します。アイデアは、一意の名前で新しいファイルを作成し、FTP PUT要求でファイル名の代わりに使用できる変数として名前を保存することです。JMeter Bean Shell Samplerエラー "ファイルをコピーするときに静的メソッドget(java.lang.String)がclass'java.nio.file.Pathsに見つかりません"
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);
私がログに受けていますエラー:
ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import java.text.; import java.nio.file.StandardCopyOption.; 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'
私はこの問題への答えを探してきた。ここ
は、私はコピーのために使用して名前を変更していたコードですsolution where the suggestion was: "私の推測では、問題はそれがvarargsパラメータに値を設定していないということです。試してください:
Path target = Paths.get(filename, new String[0]);"
私はそうのように私のコードを変更することで、このソリューションを試してみました:
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);
そして、このエラーを受け取った:私はこのエラーを打つとどのようにそれを回避することになっている理由
ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import java.text.; import java.nio.file.StandardCopyOption.; import java.io.IO . . . '' : Typed variable declaration : Method Invocation Paths.get
誰でも知っていますか?