Introduction
There are several R packages that link to or use Java, and so there exists a link between R and Javathrought the
rJava
package. The rJava
package is notoriously finicky to install in R, giventhe quirks of the Mac OS X system, Java, and R. In fact general advice is that, if you can avoid using rJava, do. It is a conundrum that even the most experienced R hands would like to avoid.I'm trying to install Windows 7 on my new MacBook with very little success. I know that Apple don't support Windows 7 on the newer Macs but I've been able to install Windows XP on my 2014 iMac pretty easily. It's just to use a piece of software that doesn't work on anything higher than Windows 7 and I don't have a license for Windows 10. Install Rattle. Then install Rattle using R's package manager. As a separate step it is usually best to install the RGtk2 package which will download the GTK libraries for Mac OS/X and link them into R.
I recently went through the process of installingrJava on a new MacBook Pro, using advice from the web. I’ll document the process I followed, with the following software:
- Mac OS X Sierra (version 10.12.6)
- Java JDK version 9.0.1
- R version 3.4.2 (Short Summer) 64-bit
- rJava version 0.9-9, installed from source
Setting the groundwork
First, we need to install the Xcode command line tools using the code
Next we install both Java 6 and the current Java version. Java 6 is apparently needed for somescaffolding and functions not present in the current version. All commands below need to be runin a Terminal.
Java 9
Install the JDK package from this link
To ensure that Java is installed, run the following functions in the Terminal
I get these results:
Setting up clang and other required software
I installed r-macos-clang using the installer availablehere. This took care of installing the version ofthe clang compiler compatible with the current R version.
This still had some problems in terms of finding some files. I then ran the following linesin the Terminal:
Setting up Java for R
Run the following two commands in the Terminal:
Installing rJava
From the Terminal, I ran the following command:
This compiles rJava from source, and for me this worked.
![How To Install R For Mac 2017 How To Install R For Mac 2017](/uploads/1/2/5/6/125676104/233479113.png)