问题
I need to run R Code from Java application. The R Server is installed on the remote box. I failed to find any information on Java connector for R. Maybe I am just exposing my ignorance, but any hints how this can be done would be appreciated.
回答1:
There are sample Java clients in the Rserve source packages. I'd point to a SVN browser but I can never remember if Simon's RForge has a SVN browser...
Here is a tree view of the client from the older package I maintain in Debian (but you probably want the eternally-unreleased 1.7.0 directly from RForge):
edd@max:~/src/debian/CRAN/Rserve-0.6-8.1$ tree src/client/java-new/
src/client/java-new/
├── JRI
│ ├── JRIEngine.java
│ ├── Makefile
│ ├── package-info.java
│ └── test
│ ├── Makefile
│ └── RTest.java
├── LICENSE
├── Makefile
├── MutableREXP.java
├── package-info.java
├── REngineCallbacks.java
├── REngineConsoleHistoryInterface.java
├── REngineEvalException.java
├── REngineException.java
├── REngineInputInterface.java
├── REngine.jar
├── REngine.java
├── REngineOutputInterface.java
├── REngineStdOutput.java
├── REngineUIInterface.java
├── REXPDouble.java
├── REXPEnvironment.java
├── REXPExpressionVector.java
├── REXPFactor.java
├── REXPGenericVector.java
├── REXPInteger.java
├── REXP.java
├── REXPJavaReference.java
├── REXPLanguage.java
├── REXPList.java
├── REXPLogical.java
├── REXPMismatchException.java
├── REXPNull.java
├── REXPRaw.java
├── REXPReference.java
├── REXPS4.java
├── REXPString.java
├── REXPSymbol.java
├── REXPUnknown.java
├── REXPVector.java
├── REXPWrapper.java
├── RFactor.java
├── RList.java
├── Rserve
│ ├── Makefile
│ ├── package-info.java
│ ├── protocol
│ │ ├── jcrypt.java
│ │ ├── REXPFactory.java
│ │ ├── RPacket.java
│ │ └── RTalk.java
│ ├── RConnection.java
│ ├── RFileInputStream.java
│ ├── RFileOutputStream.java
│ ├── RserveException.java
│ ├── Rserve.jar
│ ├── RSession.java
│ └── test
│ ├── jt.java
│ ├── Makefile
│ ├── PlotDemo.java
│ ├── StartRserve.java
│ └── test.java
└── Rserve.jar
5 directories, 60 files
edd@max:~/src/debian/CRAN/Rserve-0.6-8.1$
来源:https://stackoverflow.com/questions/16400098/running-r-code-remotely-from-java-application