0

I try to install the package XLConnectJars on macOS High Sierra 10.13.3 running MRO-3.4.2, but it gives the following error:

JavaVM: Failed to load JVM: /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
Error: package or namespace load failed for ‘XLConnectJars’:
 .onLoad failed in loadNamespace() for 'XLConnectJars', details:
  call: .jinit()
  error: JNI_GetCreatedJavaVMs returned -1

Problems with java on mac seem to be usual, I tried a lot but nothing works (I went through dozens of threads in stackoverflow or other forums, but no additional setting solved my problem).

I managed to install rJava package and it makes no problem.

Further when I run R CMD javareconf in the Terminal:

*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version     : 9.0.1
Java home path   : /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
Java compiler    : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
System Java on macOS

trying to compile and link a JNI program 
detected JNI cpp flags    : -I/System/Library/Frameworks/JavaVM.framework/Headers
detected JNI linker flags : -framework JavaVM
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/System/Library/Frameworks/JavaVM.framework/Headers  -DU_STATIC_IMPLEMENTATION -Wall -mtune=core2 -g -O2 -I/opt/X11/include   -fPIC  -DU_STATIC_IMPLEMENTATION -Wall -mtune=core2 -g -O2 -I/opt/X11/include  -c conftest.c -o conftest.o
conftest.c:4:5: warning: 'JNI_CreateJavaVM' is deprecated
      [-Wdeprecated-declarations]
    JNI_CreateJavaVM(0, 0, 0);
    ^
/System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1937:1: note: 
      'JNI_CreateJavaVM' has been explicitly marked deprecated here
JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
^
1 warning generated.
/usr/local/clang4/bin/clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/clang4/lib -o conftest.so conftest.o -framework JavaVM -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation


JAVA_HOME        : /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
Java library path: 
JNI cpp flags    : -I/System/Library/Frameworks/JavaVM.framework/Headers
JNI linker flags : -framework JavaVM
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.

where "JNI_CreateJavaVM" seems to be linked to the installation problem of package XLConnectJars.

Can someone explain me what the problem really is? What can I do, what do I have to set to get this running?

Thanks in advance.

sebastiann
  • 163
  • 10
  • what about this one? https://stackoverflow.com/a/15303968/7417402 Also maybe try java 8? – Devstr Feb 23 '18 at 22:37
  • Thanks for the link, but it remains the same error when installing XLConnectJars. – sebastiann Feb 24 '18 at 08:52
  • From what I see in the question, now it's not an error, but just a deprecation warning. – Devstr Feb 24 '18 at 09:47
  • 1
    There's detailed guide here http://www.snaq.net/software/rjava-macos.php – Devstr Feb 24 '18 at 09:52
  • 1
    @Devstr: Thanks for your link. I followed part of the guide. I installed the newest version of java and microsoft r open (possibly without java included in r as suggested in the guide (brew install r --with-java)), then running the script provided to set all path. After that I started rstudio with the recently installed r version and installed first rJava followed by XLConnectJars, which now worked perfect. Maybe just running the provided script should have also worked, but I tried to be as close as possible to the guide. – sebastiann Feb 24 '18 at 12:43

0 Answers0