因为 Ubuntu 升级到 18.04 破坏了我的工作 Eclipse 配置,所以我重新安装了 Eclipse(Photon 版本 4.8.0)并尝试再次使用带有 StatET 3.6 插件的 R。正如这里所建议的,我试图通过rj-2.1
在 R 术语控制台中安装包
install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-2.1")
这开始安装rj
和rj.gd
Installing packages into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
但以错误消息结束:
Warning message:
In install.packages(c("rj", "rj.gd"), repos = "http://download.walware.de/rj-2.1") :
installation of package ‘rj’ had non-zero exit status
仔细查看控制台输出会发现此错误消息:
checking Java support in R... configure: error: cannot determine complete java config
JAVA_HOME: /usr/lib/jvm/default-java
JAVA : /usr/lib/jvm/default-java/bin/java
JAVAC : /usr/lib/jvm/default-java/bin/javac
JAVAH :
JAVA_CPPFLAGS: -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux
JAVA_LIBS: -L/usr/lib/jvm/default-java/lib/server -ljvm
JAR : /usr/lib/jvm/default-java/bin/jar
R is not configured with full Java support. Please make sure
an JDK is installed and run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install the package.
ERROR: configuration failed for package ‘rj’
* removing ‘/usr/local/lib/R/site-library/rj’
* restoring previous ‘/usr/local/lib/R/site-library/rj’
当我运行建议的命令时
sudo R CMD javareconf
在终端中,输出表明它按预期工作
Java interpreter : /usr/lib/jvm/default-java/bin/java
Java version : 10.0.2
Java home path : /usr/lib/jvm/default-java
Java compiler : /usr/lib/jvm/default-java/bin/javac
Java headers gen.:
Java archive tool: /usr/lib/jvm/default-java/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c conftest.c -o conftest.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/default-java/lib/server -ljvm -L/usr/lib/R/lib -lR
JAVA_HOME : /usr/lib/jvm/default-java
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /usr/lib/R
Done.
尽管如此,安装之后rj-2.1
仍然会产生相同的错误消息。我看了一下/usr/local/lib/R/site-library
并rj.gd
更新了,但rj
仍然是以前的版本。并启动 R 控制台会产生错误消息
eclipse.buildId=4.8.0.I20180611-0500
java.version=10.0.2
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_GB
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product
de.walware.statet.r.console.ui
Launching the R Console was cancelled, because it seems starting the R engine failed.
Please make sure that R package 'rj' (2.1 or compatible) is installed and that the R library paths are set correctly for the R environment configuration
任何想法,如何rj
安装?
PS:好像是Java版本的问题。Ubuntu 18.04 预装了这个版本:
openjdk 10.0.2 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1, mixed mode)
更新:
在没有故意更改任何内容的情况下,现在可以从控制台安装rj
和rj.gd
从Rterm
控制台安装。中的文件/usr/local/lib/R/site-library
确实已更新,并且Rterm
控制台没有任何错误消息。
尽管如此,在创建和运行RJ
控制台时,仍会出现相同的错误消息
Launching the R Console was cancelled, because it seems starting the R engine failed.
Please make sure that R package 'rj' (2.1 or compatible) is installed and that the R library paths are set correctly for the R environment configuration 'Rstatet36'.
我也再次定义Preferences>Statet>R environment
,Run Configurations
没有效果。
更新:如果您对问题投反对票,最好添加评论,说明您为什么这样做,以便可以改进问题。或者删除。那好吧。