R 3.0.1,JVM没有找到Object

时间:2020-12-21 16:47:39

When I run Rterm.exe, I get a problem with Java. I just launch Rterm.exe and try to retrieve the Java version by using system("java - version") but it doesn't even work

当我运行Rterm.exe时,我遇到了Java问题。我只是启动Rterm.exe并尝试使用system(“java - version”)检索Java版本,但它甚至不起作用

R version 3.0.1 (2013-05-16) -- "Good Sport"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> system("java -version")
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
> Sys.getenv("JAVA")
[1] "H:\\R\\jre-7u10-windows-x64\\jre1.7.0_10\\bin\\"

2 个解决方案

#1


1  

I don't think you need java path to be set in a JAVA environment variable - eventually you could set it in the PATH environment variable, see How do I set or change the PATH system variable.

我认为您不需要在JAVA环境变量中设置java路径 - 最终您可以在PATH环境变量中设置它,请参阅如何设置或更改PATH系统变量。

However I don't have any java reference in any environment variable and it works fine on my Windows 8.1 with java versions 1.6 to 1.8.

但是我在任何环境变量中都没有任何java引用,它在我的Windows 8.1上使用java版本1.6到1.8可以正常工作。

This issue may come from an improper java installation (an installation without administration rights or an installation just consisting in unzipping a java zip directory). It can make rJava unable to be loaded for example. The simplier solution will probably be to uninstall and then reinstall Java with an installer.

此问题可能来自不正确的Java安装(没有管理权限的安装或仅包含解压缩java zip目录的安装)。例如,它可能使rJava无法加载。更简单的解决方案可能是卸载然后使用安装程序重新安装Java。

If not possible, try to set and configure your java environment with the java control panel (in the tab "java"). See Where is the Java Control Panel on Windows?.

如果不可能,尝试使用java控制面板(在“java”选项卡中)设置和配置java环境。请参阅Windows上的Java控制面板在哪里?

#2


0  

I have a line like this in my code :

我的代码中有这样的一行:

options(java.home="C:/Program Files/Java/jre7/")

Try to see if that fixes it. Make sure java is properly installed and the path is correct.

试着看看是否能修复它。确保已正确安装java并且路径正确。

#1


1  

I don't think you need java path to be set in a JAVA environment variable - eventually you could set it in the PATH environment variable, see How do I set or change the PATH system variable.

我认为您不需要在JAVA环境变量中设置java路径 - 最终您可以在PATH环境变量中设置它,请参阅如何设置或更改PATH系统变量。

However I don't have any java reference in any environment variable and it works fine on my Windows 8.1 with java versions 1.6 to 1.8.

但是我在任何环境变量中都没有任何java引用,它在我的Windows 8.1上使用java版本1.6到1.8可以正常工作。

This issue may come from an improper java installation (an installation without administration rights or an installation just consisting in unzipping a java zip directory). It can make rJava unable to be loaded for example. The simplier solution will probably be to uninstall and then reinstall Java with an installer.

此问题可能来自不正确的Java安装(没有管理权限的安装或仅包含解压缩java zip目录的安装)。例如,它可能使rJava无法加载。更简单的解决方案可能是卸载然后使用安装程序重新安装Java。

If not possible, try to set and configure your java environment with the java control panel (in the tab "java"). See Where is the Java Control Panel on Windows?.

如果不可能,尝试使用java控制面板(在“java”选项卡中)设置和配置java环境。请参阅Windows上的Java控制面板在哪里?

#2


0  

I have a line like this in my code :

我的代码中有这样的一行:

options(java.home="C:/Program Files/Java/jre7/")

Try to see if that fixes it. Make sure java is properly installed and the path is correct.

试着看看是否能修复它。确保已正确安装java并且路径正确。