R 3.0.1,JVM找不到Object

时间:2014-11-14 14:19:49

标签: java r

当我运行Rterm.exe时,我遇到了Java问题。我只是启动Rterm.exe并尝试使用系统检索Java版本(" 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 个答案:

答案 0 :(得分:1)

我认为你不需要在JAVA环境变量中设置java路径 - 最终你可以在PATH环境变量中设置它, 见How do I set or change the PATH system variable

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

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

如果不可能,尝试使用java控制面板设置和配置java环境(在选项卡" java"中)。 请参阅Where is the Java Control Panel on Windows?

答案 1 :(得分:0)

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

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

尝试查看是否可以修复它。确保正确安装了java并且路径正确。