Ive been struggling with overcomming a series of errors for using the function maxent
in the dismo
package.
Loading required package: rJava
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
Error: package ‘rJava’ could not be loaded
In addition: Warning message:
running command '/usr/libexec/java_home' had status 1
Ive tried: 1- updating my R version 2- removing and reinstalling the latest Java version 3- removing and reinstalling rJava 4- Installing JGR
None have solved the issue. Any help out there?
At the Terminal console execute:
machine-name:~ username$ which java
/usr/bin/java
machine-:~ username$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Since I have the jre installed I can go into R and run:
> library(rJava)
> help(pac=rJava)
> res <- .jinit(classpath="myClasses.jar", parameters="-Xmx512m")
> res
[1] 0 # the sign of a successful initiation
You should be displaying similar information as below:
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats4 grDevices utils datasets graphics stats
[8] methods base
other attached packages:
[1] rJava_0.9-8 MASS_7.3-47 copula_0.999-16
snipped the rest of my loaded package listing
I never had any success working with JGR so cannot help on that aspect.