本文介绍了如何在R脚本中运行可执行文件.jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在从事一个相对较大的数据分析项目,在该项目中,我编写的R脚本是主要的可执行文件,并调用了所有其他代码.我不知道如何从我的R脚本中调用可执行文件.jar,但是我还没有看到这个问题在其他地方发布...这有可能吗?
I am working on a relatively large data analytics project in which an R script I wrote is the primary executable, calling all other bits of code. I can't figure out how to call an executable .jar from my R script, however and I haven't seen this question posted elsewhere... is this a possibility?
推荐答案
您可以使用rJava
创建Java对象的实例.然后调用它的方法..
You can use rJava
to create an instance of your java Object. Then you call its methods ..
library(rJava)
.jinit(PATH_TO_YOUR_JAR) # this starts the JVM
jobject <- .jnew("yourJavaClass") ## call the constructor
.jcall(jobject ,"I",method="YOUR_METHOD") ## call a method
这篇关于如何在R脚本中运行可执行文件.jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!