How Does One Configure Rjava on Osx to Select the Right Jvm -- .Jinit() Failing

maxent RJava situation 1001

At the Terminal console execute:

machine-name:~ username$ which java
/usr/bin/java
machine-:~ username$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Since I have the jre installed I can go into R and run:

> library(rJava)
> help(pac=rJava)
> res <- .jinit(classpath="myClasses.jar", parameters="-Xmx512m")
> res
[1] 0 # the sign of a successful initiation

You should be displaying similar information as below:

> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] parallel stats4 grDevices utils datasets graphics stats
[8] methods base

other attached packages:
[1] rJava_0.9-8 MASS_7.3-47 copula_0.999-16
snipped the rest of my loaded package listing

I never had any success working with JGR so cannot help on that aspect.

Getting R to use newer versions of java

Seems like on Mac OS X you can have multiple Java at a one time.

Use below command on terminal to check how many JDK version you have.

/usr/libexec/java_home -V

You can follow below instruction to have correct Java Path setup:

How To Set $JAVA_HOME Environment Variable On Mac OS X

In nutshell do:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)



Related Topics



Leave a reply



Submit