During the course I co-taught with Matt Fitzpatrick in Glasgow a few weeks ago, it came out that a number of people were having trouble installing ENMTools. A lot of this seems to stem from the newest version of R, and in particular how it interacts with your Java installation.
Some Mac users (including me) were able to fix this just by going to the console and typing "R CMD javareconf" and restarting R.
Windows users seemed to have much more significant issues, however. There seemed to be several issues, but here's a solution that helped several of the students, courtesy of Hirzi Luqman:
Error:
* installing *source* package ‘ENMTools’ ...
** R
** data
*** moving datasets to lazyload DB
** tests
** byte-compile and prepare package for lazy loading
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framewo rk/Versions/3.5/Resources/ library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.f ramework/Versions/3.5/Resource s/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachi nes/jdk-9.jdk/Contents/Home/ lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framewor k/Versions/3.5/Resources/ library/rJava/libs/rJava.so
Reason: image not found
ERROR: lazy loading failed for package ‘ENMTools’
* removing ‘/Library/Frameworks/R.framewo rk/Versions/3.5/Resources/ library/ENMTools’
Installation failed: Command failed (1)
Problem:
ENMtools/rJava was looking for (and couldn't find) the library "libjvm.dylib" in the directory "/Library/Java/JavaVirtualMach ines/jdk-9.jdk/Contents/Home/ lib/server/", because no such directory existed (this refers to a Java 9 installation); I don't know why it looked for the file there...
Solution: I just copied the same file from the Java 8 directory (or whatever Java version is installed on the computer; in my case the directory was "/Library/Java/JavaVirtualMach ines/jdk1.8.0_45.jdk/Contents/ Home/lib/server/") to the R library directory "/Library/Frameworks/R.framewo rk/Versions/3.5/Resources/lib/ ", and it worked
Some Mac users (including me) were able to fix this just by going to the console and typing "R CMD javareconf" and restarting R.
Windows users seemed to have much more significant issues, however. There seemed to be several issues, but here's a solution that helped several of the students, courtesy of Hirzi Luqman:
Error:
* installing *source* package ‘ENMTools’ ...
** R
** data
*** moving datasets to lazyload DB
** tests
** byte-compile and prepare package for lazy loading
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framewo
dlopen(/Library/Frameworks/R.f
Referenced from: /Library/Frameworks/R.framewor
Reason: image not found
ERROR: lazy loading failed for package ‘ENMTools’
* removing ‘/Library/Frameworks/R.framewo
Installation failed: Command failed (1)
Problem:
ENMtools/rJava was looking for (and couldn't find) the library "libjvm.dylib" in the directory "/Library/Java/JavaVirtualMach
Solution: I just copied the same file from the Java 8 directory (or whatever Java version is installed on the computer; in my case the directory was "/Library/Java/JavaVirtualMach