[英]How to deal with “Java Heap Space” error while running rjava
I am using rJava package in R on MacOS.我在 MacOS 上的 R 中使用 rJava package。 This error happened:发生了这个错误:
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.OutOfMemoryError: Java heap space
I need rJava to open an Excel file with xlsx package.我需要 rJava 来打开一个带有 xlsx package 的 Excel 文件。 With this error I can not read the.xlsx files.由于此错误,我无法读取 .xlsx 文件。 I wonder how to solve this problem?我想知道如何解决这个问题?
You need to modify the java parameters with the following function at the start of your script.您需要在脚本开始时使用以下 function 修改 java 参数。
options(java.parameters = "-Xmx8000m")
You may also need restart your environment first.您可能还需要先重新启动环境。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.