gpt4 book ai didi

java - Rserve 异常 : Handshake failed

转载 作者:行者123 更新时间:2023-12-04 06:00:47 24 4
gpt4 key购买 nike

我是 R 语言的新手
并且正在使用 RConnection 在 java 中尝试一个简单的程序,但它给出了这个异常

org.rosuda.REngine.Rserve.RserveException: Handshake failed: expected 32 bytes header, got -1
at org.rosuda.REngine.Rserve.RConnection.<init>(RConnection.java:107)
at org.rosuda.REngine.Rserve.RConnection.<init>(RConnection.java:60)
at org.rosuda.REngine.Rserve.RConnection.<init>(RConnection.java:44)
at test.sandeep.main(sandeep.java:9)

那是 RConnection 的联系人.谁能告诉我可能有什么问题
包装测试;
import org.rosuda.REngine.Rserve.RConnection;

public class sandeep {
public static void main(String[] str) {

try {
System.out.println("hii");
RConnection c = new RConnection();
System.out.println("hii");
double d[] = c.eval("rnorm(10)").asDoubles();
for (double td : d) {
System.out.println(td);
}

} catch (Exception ex) {
ex.printStackTrace();
}

}

}

最佳答案

如果您在 linux 机器上运行 RServe,请确保您在/etc/位置具有名称为“Rserv.conf”和内容的配置文件

远程启用

这使远程访问 RServe

关于java - Rserve 异常 : Handshake failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8925000/

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