Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rJava uses 1.6 instead of the current Java version #78

Closed
blernermhc opened this issue Jun 8, 2016 · 4 comments
Closed

rJava uses 1.6 instead of the current Java version #78

blernermhc opened this issue Jun 8, 2016 · 4 comments

Comments

@blernermhc
Copy link

I am running rJava 0.9-8 on a Mac OSX 10.10.5. The current version of Java installed is 1.8:

~ -> java -version
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

However, rJava is using 1.6:

> .jcall("java/lang/System", "S", "getProperty", "java.version")
[1] "1.6.0_65"

I have followed advice found on stackoverflow to resolve this, including running javareconf and installing rJava from source. I have also tried rJava 0.9-9. I get the same error in RStudio and the R command line and R gui. I have also tried restarting RStudio and rebooting. None of these have helped.

This is what ldpaths contains:

: ${JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre}
: ${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/server}
if test -n ""; then
: ${R_LD_LIBRARY_PATH=${R_HOME}/lib:}
else
: ${R_LD_LIBRARY_PATH=${R_HOME}/lib}
fi
if test -n "${R_JAVA_LD_LIBRARY_PATH}"; then
  R_LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${R_JAVA_LD_LIBRARY_PATH}"
fi
## This is DYLD_FALLBACK_LIBRARY_PATH on Darwin (OS X) and LD_LIBRARY_PATH elsewhere
if test -z "${DYLD_FALLBACK_LIBRARY_PATH}"; then
  DYLD_FALLBACK_LIBRARY_PATH="${R_LD_LIBRARY_PATH}"
else
  DYLD_FALLBACK_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${DYLD_FALLBACK_LIBRARY_PATH}"
fi
export DYLD_FALLBACK_LIBRARY_PATH

This is what is in javaconf

## Versions from settings when configure was run
: ${JAVA_HOME=}
: ${JAVA_CPPFLAGS=~autodetect~}
: ${JAVA_LD_LIBRARY_PATH=~autodetect~}
: ${JAVA_LIBS=~autodetect~}

Thanks for your help!

@scottschreckengaust
Copy link

I forked and now only difference is https://github.com/s-u/rJava/pull/16/files

@s-u
Copy link
Owner

s-u commented Jun 27, 2016

rJava uses whatever you link it against. Make sure you link against the correct jvm and that it contains the path in the id and/or it can be found on the library path. All of this is automatic if you use regular R distribution - but note that only the R script sets the library path so in other cases you may want to fix the jvm id location if your'e using the Oracle binaries which often don't do that.

@gwerbin
Copy link

gwerbin commented Aug 20, 2016

Are you still having issues? Can you say you "ran javareconf" what exactly did you run?

There is a note about this issue in the Homebrew formula for R It says:

To enable rJava support, run the following command:

R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers

If you've installed a version of Java other than the default, you might need to instead use:

        R CMD javareconf JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers -I/Library/Java/JavaVirtualMachines/jdk<version>.jdk/"

      (where <version> can be found by running `java -version`, `/usr/libexec/java#{'_'}home`, or `locate jni.h`), or:

        R CMD javareconf JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers -I$(/usr/libexec/java#{'_'}home | grep -o '.*jdk')"

@blernermhc
Copy link
Author

Thanks for checking back. We are no longer using rJava and instead communicating via a socket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants