gpt4 book ai didi

java - 在 Windows 上设置 Java R 接口(interface) (JRI)

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:21:08 26 4
gpt4 key购买 nike

我已按照网络上的指南进行操作并查看了有关 stackoverflow 的问题,但我仍然无法在 Windows 上设置 JRI。

以下是我采取的步骤:

1)安装R

2) 在R中执行install.packages("rJava")安装rJava

3) 创建一个 R_HOME 系统变量,其值为 C:\Program Files\R\R-3.1.2

4) 将以下内容添加到我的 PATH 变量中:C:\Program Files\R\R-3.1.2\bin\x64;C:\Users\USERNAME\Documents\R\win-library\3.1\rJava\jri\x64

5) 添加 JRI.jar(位于 C:\Users\USERNAME\Documents\R\win-library\3.1\rJava\jri)作为 IntelliJ 的依赖

6) 将 IntelliJ 中的 VM 选项设置为 -Djava.library.path=C:\Users\USERNAME\Documents\R\win-library\3.1\rJava\jri\x64/p>

7) 启动R并执行library("rJava")

8) 运行我的程序来测试是否一切都已设置好

得到如下错误:

#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006c726096, pid=5860, tid=6932
#
# JRE version: Java(TM) SE Runtime Environment (8.0_31-b13) (build 1.8.0_31-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.31-b07 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [R.dll+0x26096]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\USERNAME\Documents\Project\hs_err_pid5860.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

如果我删除 VM 选项以便未指定 java.library.path,则会收到以下错误:

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:1865)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:19)
at com.coagsm.cs.fyp.Test.<clinit>(Test.java:11)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)

最佳答案

如何实例化 Rengine?

应该是这样的:

Rengine rengine = new Rengine(args, false, null);

其中,args 可能来自您的主要方法。

让我知道这是否有效!

关于java - 在 Windows 上设置 Java R 接口(interface) (JRI),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28974392/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com