3
votes

I am trying to install RWeka package on mac.

OS version:

10.9.5

Java version installed:

java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)

After executing

install.packages("RWeka")

when I try to execute

library(RWeka)

the following error is displayed

Error : .onLoad failed in loadNamespace() for 'RWekajars', details:
call: .jinit()
error: JNI_GetCreatedJavaVMs returned -1

Error: package or namespace load failed for ‘RWeka’
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.

The output of command

R CMD javareconf

is

xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Java interpreter : /usr/bin/java
Java version : 1.7.0_75
Java home path : /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Non-system Java on OS X

trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
detected JNI linker flags : -L/Users/amlanroy/Library/Java/Extensions -L/Library/Java/Extensions -L/Network/Library/Java/Extensions -L/System/Library/Java/Extensions -L/usr/lib/java -L. -ljvm
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Unable to compile a JNI program

JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.

Please let me know if anybody has faced the same issue and knows the solution.

2

2 Answers

9
votes
  1. sudo R CMD javareconf
  2. install.packages("rJava",type='source')

rJava package will solve the bugs.

Cite these from this or this.

7
votes

I had also problems with loading packages like openNLP, xlsx, RWeka, ... and got the same error message like you. But finally this command worked for me on OS X 10.11.3:

sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib