user4404699 user4404699 - 1 month ago 15
R Question

Trouble installing package "OpenStreetMap" in RStudio

I am trying to install

OpenStreetMap
in RStudio.
I am under
OS 10.11.3
.
My java version is :
➜ ~ java -version
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)


When I install it I have the following message :
`


install.packages("OpenStreetMap")
Installing package into ‘/Users/anhnguyen/Library/R/3.2/library’
(as ‘lib’ is unspecified)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 2 2209k 2 49152 0 0 61339 0 0:00:36 --:--:-- 0:00:36 61286 29 2209k 29 658k 0 0 367k 0 0:00:06 0:00:01 0:00:05 367k 95 2209k 95 2114k 0 0 757k 0 0:00:02 0:00:02 --:--:-- 757k100 2209k 100 2209k 0 0 774k 0 0:00:02 0:00:02 --:--:-- 774k
The downloaded binary packages are in /var/folders/qm/gj1n93fd7rg8rgz1ldq19gm80000gn/T//Rtmpuwj9O5/downloaded_packages
`


Then when loading the library I have :
`


library(OpenStreetMap)
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.
Error in .jinit() : JNI_GetCreatedJavaVMs returned -1
Error : .onLoad a échoué dans loadNamespace() pour 'OpenStreetMap', détails :
appel : fun(libname, pkgname)
erreur : Java classes could not be loaded. Most likely because Java is not set up with your R installation.
Here are some trouble shooting tips:
1. Install Java

2. Run
R CMD javareconf
in the terminal. If you are using Mac OS X >= 10.7 you may want to try
R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
instead.
Erreur : le chargement du package ou de l'espace de noms a échoué pour ‘OpenStreetMap’
`


I have already installed other packages without problem.
I have read that it might missed
rjava
and has installed it as well without solving my current problem.

Thank you for your help.

Answer

So in the end, in spite of having java already installed I did this:

1) I reinstalled java with this link https://support.apple.com/kb/DL1572?locale=en_US without removing my already installed java 2) I ran in my terminal R CMD javareconf though my MacOS was >= 10.7

I have to say that months ago I did solve this problem and even though today the same error appeared again.