Java Mac El Capitan

If your Mac isn't compatible with the latest macOS, you might still be able to upgrade to an earlier macOS, such as macOS Catalina, Mojave, High Sierra, Sierra, or El Capitan. To get the latest features and maintain the security, stability, compatibility, and performance of your Mac, it's important to keep your software up to date. Dreamweaver not working on El Capitan!Java SE 6 not working and you can not downgrade?CS6 Not working, can't install Java SE 6 El Capitan?Not a problem.CS6 N.

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.

Java Mac El Capitan

Java

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 Se 6 Runtime Mac El Capitan

Please note the 1.7 version are really not needed here.

Java Download Mac El Capitan

Java

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.

rJava

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

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

Java Se 6 Runtime Download For Mac El Capitan

RStudio

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

Download Java 8 For Mac 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.