how to get java V8 in OS X Sierra

I did install java V8, but when I ask "java -version" the answer is java V6.

I need recognize java V8 to use some packages in R.

Posted on Aug 12, 2017 11:57 AM

Reply
14 replies

Sep 9, 2017 3:50 PM in response to jefrancod

If you are getting errors when trying to load the rJava library like this:

Error: package or namespace load failed for ‘rJava’:

.onLoad failed in loadNamespace() for 'rJava', details:

call: dyn.load(file, DLLpath = DLLpath, ...)

error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJav a.so':

dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/lib s/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib

Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava .so

Reason: image not found


Follow the instructions here: r - trouble installing and loading rJava on mac El Capitan - Stack Overflow

Note that the instructions use the path to an old version of Java 8.

If you go to Terminal and use this command:

/usr/libexec/java_home -v "1.8+"

it will return a path you can copy and paste into the appropriate places in RStudio Console.

Also, note that Step 1 is in Terminal and the rest is in RStudio or R console.

Sep 17, 2017 4:24 AM in response to Barney-15E

Hello Barney, Thanks a lot, I had advanced, as you can see I am a beginner.

Did install java.jdk and java.jrs, next did follow the instructions as you can see below (using terminal):


> options("java.home")

$java.home

NULL


> options("java.home"="/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Content s/Home/jre")

> Sys.setenv(JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Conten ts/Home')

> Sys.setenv(LD_LIBRARY_PATH='$JAVA_HOME/jre/lib/server')

> install.packages("rJava")

Installing package into ‘/Users/JFranco/Library/R/3.4/library’

(as ‘lib’ is unspecified)

trying URL 'https://mran.microsoft.com/snapshot/2017-09-01/bin/macosx/el-capitan/contrib/3.4 /rJava_0.9-8.tgz'

Content type 'application/octet-stream' length 627959 bytes (613 KB)

==================================================

downloaded 613 KB


The downloaded binary packages are in

/var/folders/gp/hypk6wk539j2wn8xhlyfbs3c0000gn/T//Rtmp7xQ3Lu/downloaded_packages

> library(rJava)


*** caught segfault ***

address 0x18, cause 'memory not mapped'

Aug 13, 2017 2:50 AM in response to Kurt Lang

Thanks Kurt. Yes I did it, and did install "jre-8u144-macosx-x64", in java control panel the version is recognized. But the answer in monitor is as below. I need java 8 to use a package R, using RSTUDIO.

192:~ JFranco$ java -version

java version "1.6.0_65"

Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)

Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)

Aug 13, 2017 9:39 AM in response to jefrancod

The Terminal output means you also have Apple's Java 6 installed. That doesn't mean Java 8 has been installed incorrectly. Terminal simply doesn't report it.


It's possible RStudio is looking for the JDK version of Java 8, rather than the simpler runtime version. Check with the maker of JDK before installing any other Java versions. They should be able to steer you in the right direction.

Thanks, I need run a package in R, not java programs.

If it's looking for Java, then at least part of the application package is a Java app.

Aug 13, 2017 9:50 AM in response to jefrancod

Since you have Java 6 installed, try /usr/libexec/java_home (not JAVA_HOME) in Terminal. It will list the path of all installed Java versions.

Depending on the response from RStudio, you could just java_home to set the JAVA_HOME environment variable so that the java command runs that version.

$ export JAVA_HOME=`/usr/libexec/java_home -v 1.8+`

However, you may have to explicitly set the java home path in that R package. Which package is it?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

how to get java V8 in OS X Sierra

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.