我有一个调用 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 文件中。如果我这样做了,有没有办法从代码中调用脚本?我应该使用哪条路径?
非常感谢提前