Rスクリプトを呼び出すJavaプログラムがあります。コマンドは次のとおりです。
String filename = "hierarchicalClusteringScript.R";
String[] cmd=new String[]{this.conn.getRPath(),"CMD","BATCH",
"--args LD_matrix='"+LD_matrix+"' " +
"image_filename='"+image_filename+"' " +
"width="+300+" "+
"height="+height+" "+
"ordered_snps_filename='"+ordered_snps_filename+"'",
filename,
this.conn.getWorkingDir()+this.conn.getProjectName()+"Routput.txt"};
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec(cmd);
process.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
Rスクリプト「hierarchicalClusteringScript.R」をjarファイルに含めたいと思います。私がそうする場合、コードからスクリプトを呼び出す方法はありますか?どのパスを使用する必要がありますか?
よろしくお願いします