首页 > 代码库 > rJava在ubuntu上的安装

rJava在ubuntu上的安装

1、Oracle JDK 8(必须装oracle的,open的不行)

Install Oracle JDK 8 on Linux x64 (eg: Debian)
http://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre

1) download JDK 8 from Oracle, jdk-8uversion-linux-x64.tar.gz
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2) 
http://docs.oracle.com/javase/8/docs/technotes/guides/install/linux_jdk.html#BJFJJEFG
$ sudo mkdir -p /usr/lib/jvm
$ sudo tar zxf jdk-8u121-linux-x64.tar.gz -C /usr/lib/jvm/
$ sudo chown -R root:root /usr/lib/jvm/jdk1.8.0_121

$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_121/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_121/bin/javac" 1

$ sudo chmod a+x /usr/bin/java
$ sudo chmod a+x /usr/bin/javac

$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac

$ java -version

注意跟你的版本型号保持一致,例如jdk1.8.0_121

2、rJava安装

sudo R CMD javareconf   #以root权限配置rJava环境
sudo R
install.packages("rJava")
library(rJava)

 

rJava在ubuntu上的安装