我正在尝试安装在 Ubuntu Linux 12.04 上运行的 R 2.14.1 的 RWeka 包。我输入:
install.packages("RWeka")
选择一个镜像并下载。
然后我收到这些消息:
configure: error: Java Development Kit (JDK) is missing or not registered in R
Make sure R is configured with full Java support (including JDK). 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 rJava.
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/~/R/x86_64-pc-linux-gnu-library/2.14/rJava’
ERROR: dependency ‘rJava’ is not available for package ‘RWekajars’
* removing ‘/home/~/R/x86_64-pc-linux-gnu-library/2.14/RWekajars’
ERROR: dependencies ‘RWekajars’, ‘rJava’ are not available for package ‘RWeka’
* removing ‘/home/~/R/x86_64-pc-linux-gnu-library/2.14/RWeka’
The downloaded packages are in
‘/tmp/RtmpZBJDM0/downloaded_packages’
Warning messages:
1: In install.packages("RWeka") :
installation of package ‘rJava’ had non-zero exit status
2: In install.packages("RWeka") :
installation of package ‘RWekajars’ had non-zero exit status
3: In install.packages("RWeka") :
installation of package ‘RWeka’ had non-zero exit status
于是我退出并输入:
sudo apt-get install icedtea-7-plugin
让它运行,然后:
root@ubuntu:~# R CMD javareconf
Java interpreter : /usr/bin/java
Java version : 1.6.0_24
Java home path : /usr/lib/jvm/java-6-openjdk-amd64/jre
Java compiler : not present
Java headers gen.:
Java archive tool:
Java library path: /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
JNI linker flags : -L/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server -L/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64 -L/usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib/x86_64-linux-gnu/jni -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -L/usr/lib/jni -L/lib -L/usr/lib -ljvm
JNI cpp flags :
Updating Java configuration in /etc/R
Done.
然后我返回并启动 R 并输入 install.packages("RWeka")
并得到与之前相同的错误消息。
有什么建议么?
答案1
看起来您可能安装了 JRE(Java 运行时环境),但没有安装 JDK(Java 开发工具包)。
尝试:
sudo apt-get install openjdk-6-jdk
然后尝试再次安装该包。