7

RESOLVED!!

See my solution below, in case this question helps others in the future.

Error

As the title described, it it failing for me. The error I'm receiving, when I attempt to install.packages('rJava') from inside R is (with some preceding good checks):

checking whether JNI programs can be compiled... yes
checking JNI data types... configure: error: One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this.
ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/local/lib/R/3.2/site-library/rJava’

Fix Attempts

I have checked and tried the following resolutions, none of which worked for me:

No such luck, with any of these attempts.


I had previously had rJava (and RJDBC) installed properly.

[Edit: I later found out, the actual problem was upgrading to OS X 10.11, El Capitan.]


Configuration

$ java -version
java version "1.8.0_45"

> R.Version()
$platform
[1] "x86_64-apple-darwin15.0.0"
$version.string
[1] "R version 3.2.2 (2015-08-14)"

Mac OS itself:

System Version: OS X 10.11.1 (15B42)

1
  • The solution above got rJava to work. However, to get things to work for RStudio (not just the command line) I also needed to follow the suggestion found in the answer here: stackoverflow.com/questions/30738974/… Commented Feb 18, 2016 at 4:21

2 Answers 2

5
+25

I did not do the LD_LIBRARY_PATH, as it did not seem relevant to a Mac

Yes, but a Mac has DYLD_LIBRARY_PATH. If you link with -ljvm you have to have the directory containing libjvm.dylib in DYLD_LIBRARY_PATH.

That said, I found it more convenient to link JNI programs with -ljli (in lib/jli), because the programs linked with -ljvm will open a prompt to install Apple's own Java runtime when the system doesn't have it (at least they did on my and our customers' systems some while ago).

Edit: here's a link to the dyld documentation

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for those details! The DYLD documentation is great. It wasn't my problem, however, as you'll see below.
5

I finally resolved this, via a solution I found here.

The new Mac OS X (10.11, El Capitan) has trouble with env variables.


The newest dev flavor of rJava manages to handle things correctly. Here is what I did to resolve it:

  1. Download version 0.9-8 (rJava_0.9-8.tar.gz) from here
  2. Install it from the downloaded source:

    $ R CMD INSTALL ~/Downloads/rJava_0.9-8.tar.gz

(Or wherever you put it)

That's all it took!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.