Java El Capitan

Apple has posted notice that Mac OS X 10.11 (El Capitan) will be the last OS X release that supports Java 6, and as such, recommends developers whose applications depend on Java 6 to migrate their apps to a newer Java version provided by Oracle. Oct 01, 2015 After installed the OS X El Capitan I get the message: to open 'CS5ServiceManager' you need to install the legacy Java SE 6 runtime. Java for OS X 2015-001 installs the legacy Java 6 runtime for OS X 10.11 El Capitan, OS X 10.10 Yosemite, OS X 10.9 Mavericks, OS X 10.8 Mountain Lion, and OS X 10.7 Lion. This package is exclusively intended for. Jun 11, 2015 I have a clean install of El Capitan. I have PHPStorm installed on my Macbook Air. Download Java 6 for El Capitan: Java for OS X 2015-001 Beta.

Since I upgraded my Mac to OS X El Capitan (version 10.11.2) I am having problems with the R-package rJava. From what I understood, eventually, it is not a problem of rJava or R or RStudio in the first place, but newer versions of Mac OS X do not play well with the latest versions of Oracle’s Java (jdk). Furthermore, some new security features in Mac OS X prevent that environment path settings are passed along to applications like RStudio.

In what follows, I listed the steps that solved for me the problem that the package rJava could not be loaded from within RStudio under Mac OS X El Capitan (version 10.11.2).

Problem statement

Unfortunately, the package rJava does not just fail to load, but the R GUI for Mac terminates instantly and in RStudio the R-session gets closed. Both effects are pretty annoying! See the screen shot below on how that might look like.

Mac

Some research

After searching the web, the details of the problem are still not clear to me. But it appears that OS X has problems recognizing newer versions Oracle’s Java. OS X seams to be looking for a legacy version 6 of Apple’s own build of Java. As shown in the next section one solution seams to be the installation of Apple’s legacy version 6 of Java and a newer version (e.g. 1.8.0_66) of Oracle’s Java at the same time.

The solution

The post available at https://github.com/snowflakedb/dplyr-snowflakedb/wiki/Configuring-R-rJava-RJDBC-on-Mac-OS-X solved my problem with rJava on Mac OS X 10.11.2.

Java 6

I already had XCode command line tools installed, so I started at section Java 6. I downloaded the legacy Java 6 runtime from https://support.apple.com/kb/DL1572?locale=de_DE and installed the downloaded .dmg file.

Java 8

Since I had already installed the latest version of Oracle’s jdk from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, I skipped the step.

The output of java_home on my machine looks as follows

Java Download Mac El Capitan

Please note the 1.7 version are really not needed here.

R for OS X

The latest version of R was already running, so I skipped this step. The check with javareconf gave the following result.

Java

rJava

Uninstall Java Mac El Capitan

As the version of rJava from CRAN did not work, I took the latest version from rforge and installed that one.

Java El Capitan Software

A quick check whether rJava can be loaded, is done as follows

Java For Mac Os X El Capitan

RStudio

Java For El Capitan

Running the above check on the RStudio console still gives the following error

Install Java El Capitan

For some reason which might be connected to a new security feature of Mac OS X, the file libjvm.dylib cannot be found. Loading this library explicitly, as was described in http://stackoverflow.com/questions/30738974/rjava-load-error-in-rstudio-r-after-upgrading-to-osx-yosemite, finally solves the problem.