2014-11-14 102 views
0

当我运行Rterm.exe时,出现Java问题。我刚刚推出Rterm.exe并尝试通过使用系统(“爪哇 - 版”),以获取Java版本,但它甚至不工作R 3.0.1,JVM找不到对象

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\\" 
+0

你有没有试过这些指针? http://stackoverflow.com/questions/11808829/jre-1-7-returns-java-lang-noclassdeffounderror-java-lang-object – 2014-11-18 13:28:40

回答

0

我在我的代码,这样一行:

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

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

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?