Hojo.Timberwolf
Hojo.Timberwolf

Reputation: 1081

R keeps using Java12 and the Broken JNI error

All using OSX

Due to issues with conda Rstudio and not installing rgraphviz. I decided to fresh install Rstudio and just use it. Everything appeared to work finely until I tried to use RJDBC to access my database.

It worked fine when connected with anaconda but alone, I receive the following error

library(RJDBC)

PathDriver = "~/driver/hsqldb.jar"
JDBCDriver = "org.hsqldb.jdbcDriver"
drv <- JDBC(JDBCDriver,PathDriver)

WARNING: Initial Java 12 release has broken JNI support and does NOT work. Use stable Java 11 (or watch for 12u if avaiable).

I looked up my current java version in the terminal

(base):$ java -version

openjdk version "1.8.0_152-release"
OpenJDK Runtime Environment (build 1.8.0_152-release-1056-b12)
OpenJDK 64-Bit Server VM (build 25.152-b12, mixed mode)

confusing but either way I try to update to java 11 and reset the java R is using

brew cask install java11

and the java version still reads as java 1.8.0

Going into R, I still receive the error above. How do I fix this so I can use Java 11 in R?

Upvotes: 1

Views: 872

Answers (1)

user2554330
user2554330

Reputation: 44788

You need to run

R CMD javareconf

in the terminal to get R and Java in sync.

Upvotes: 2

Related Questions