这是我之前一篇关于在 Mac 上使用 R 和 JAVA 的后续文章。我的应用程序依赖于 R 来运行。我已经安装了 Java,Java 版本“1.6.0_37”。我已经安装了“R”,R 版本 2.15.1。现在我需要包含在rJava中的 JRI 。
在 R 内部,我运行了以下命令
install.packages('rJava',,' http: //www.rforge.net/ ')
这是输出:
install.packages('rJava',,'http://www.rforge.net/')
trying URL 'http://www.rforge.net/bin/macosx/leopard/contrib/2.15/rJava_0.9-4.tgz'
Content type 'application/x-gzip' length 506489 bytes (494 Kb)
opened URL
==================================================
downloaded 494 Kb
The downloaded binary packages are in
/var/folders/gz/1jwm65h12132yq8_1wdsl9cr0000gn/T//RtmpGHpTYR/downloaded_packages
我从这里去哪里?
启动tomcat时出现以下错误:
Cannot find JRI native library!
Please make sure that the JRI native library is in a directory listed in java.library.path.
java.lang.UnsatisfiedLinkError: no jri in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:9)
at com.visibleequity.servlets.VisibleEquityServlet.init(VisibleEquityServlet.java:55)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1274)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5320)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1673)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
更新 2/15/13 尝试设置环境变量后...
我自己的路:
DAVIDs-MacBook-Pro-2:~ dave$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin:/usr/local/mysql/bin:/usr/libexec/java_home:/Library/Frameworks/R.framework/Versions/2.15:/Library/Frameworks/R.framework/Versions/2.15/Resources/library/rJava/jri
仍然收到上面的错误。