Java For Mac 10.11
The R script uses rJava and RJDBC packages to load tables from database. In Mac OS X, to correctly load this packages
requires the following steps borrowed from https://github.com/snowflakedb/dplyr-snowflakedb/wiki/Configuring-R-rJava-RJDBC-on-Mac-OS-X.
Steps have been modified to reflect problems (and it's solutions) reported here.
You cannot develop android apps without java on a Mac, so this is a real bummer. Nov 07, 2018 Thanks for visiting the Apple Support Communities and asking about Java in macOS Mojave 10.14. This information is from Oracle, which states: Java and Apple Safari Browser - Oracle. Java and Apple Safari Browser. This article applies to: Platform(s): macOS; Browser(s) Safari; Safari 12 and above no longer supports NPAPI (technology required for.
Overview
This is the list of software downloads needed in order to connect R via RJDBC
to a database:
- Xcode Command Line Tools
- Java 6
- Java 8
- R
- rJava source package
- Database JDBC jar file
- RStudio (optional)
If you have any of this software already installed, you can skip that section.
Open Terminal.app
We'll change to the Downloads directory as we'll have to download some packages from the internet.
Just to make debugging easier if something does not go as planned, log all output.
Xcode Command Line Tools
We need Xcode Command Line Tools, by running this command we will invoke the downloader if not installed, otherwise it will report it is already installed.
Java 6
Install the legacy Java 6 runtime which is needed despite us not going to use Java 6.
Now walk through the install to complete.
Java 8
Install Java 8. Note: newer versions may be available.
Now walk through the install to complete.
We'll run these two commands to output Java installations and what the current command defaults to. They are informative only.
You should see something like this:
R for OS X
Download and install the R package for OS X.
Now walk through the install to complete.
Now we need to tell R to use our Java 8 as it's JAVA_HOME
You should see output similar to
Now install rJava
from source and compile it against the Java 8 JDK.The 'unset JAVA_HOME' takes care of:
Now let's check that rJava can be loaded correctly and returns the correct JDK version.This command should return the string 1.8.0_111-b14
(or whatever Java 8 version you installed).
Finish
Exit from the script logging.
Using RStudio.app or R.app
A common error when trying to load rJava in RStudio is:
There are three ways to get around this problem and use rJava
with RStudio or R console (R.app) :
1 - Launching from the command line
You can launch it from the command line in Terminal.app like such:
This is a known limitation with RStudio on OS X. See this link for more details:[https://support.rstudio.com/hc/communities/public/questions/200650933-rJava-fails-to-load-in-RStudio-Desktop-OS-X](https://support.rstudio.com/hc/communities/public/questions/200650933-rJava-fails-to-load-in-RStudio-Desktop-OS-X)
2 - Make a symlink to libjvm.dylib
This is an alternate solution to loading RStudio, but must be updated any time you upgrade Java
ZC100/300 Series DZCG.1.0.0.0 Mac Driver (released 2-July-2018) Download 114 MB OPERATING SYSTEM: Mac. DRIVERS & SOFTWARE. Download drivers, software patches, and other updates for your Dynabook & Toshiba product. Continue »; BATTERY REPLACEMENT. Batteries on all Dynabook notebooks are replaceable, if your Notebook battery needs replacement either in warranty or out of warranty, Dynabook recommends taking it to an authorized provider for the battery to be replaced. The Official Dynabook & Toshiba Support Website provides support for Camileo PA5012U-1C0K Camileo Z100. Camileo z100 drivers.
+Based on this Stack Overflow thread, one can use the following to work around the libjvm.dylib
loading issues.
3 - Load the library in the script (which is the used approach in the CohortEx R script)
Just a bit of code in your R script:
My previous post about installing Java on OS X received quite a bit of traffic, and I felt that some of the information was outdated, and it became a little unclear after all the edits, so I’ve endeavoured to create a much easier to understand set of instructions.
The instructions for installing the JDK (Java Development Kit) are a subset of the instructions for installing just the JRE, because Oracle provides an installer for the JDK.
- Go to the Oracle Java downloads page and download the JDK installer. You should end up with a file named something similar to
jdk-8u60-macosx-x64.dmg
, but perhaps a newer version. - Open the
.dmg
Disk Image and run the installer. - Open
Terminal
- Edit the JDK’s newly installed
Info.plist
file to enable the included JRE to be used from the the command line, and from bundled applications:The third line fixes a permissions issue create by using
defaults write
. The fourth line is not required, but makes the file more user-friendly if you open it again in a text editor. - Create a link to add backwards compatibility for some applications made for older Java versions:
- Optional: If you’re actually using the JDK for software development, you may want to set the
JAVA_HOME
environment variable. The recommended way is to use/usr/libexec/java_home
program, so I recommend settingJAVA_HOME
in your.bash_profile
like Jared suggests:This will get the latest installed Java’s home directory by default, but check out
man java_home
for ways to easily get other Java home directories.
You should be done now, so try and open the application. If it does not work, some applications require legacy Java 6 to be installed. You can have it installed without actually using it, however, it’s possible to trick the applications into thinking legacy Java 6 is installed, without actually doing so.
If you’re running El Capitan, this is actually a little difficult now, because Apple added SIP (System Integrity Protection) to OS X. I have written a post explaining how to disable and enable SIP.
If you’ve disabled SIP, or are not running El Capitan yet, you can trick some applications into thinking legacy Java 6 is installed by creating two folders with the following commands in Terminal
:
Don’t forget to enable SIP again after creating these directories.