I got the following messages in R when I tried to load OpenStreetMap library:
> library(OpenStreetMap)
Error in .jinit() : JNI_GetCreatedJavaVMs returned -1
Error : loadNamespace()里算'OpenStreetMap'时.onLoad失败了,详细内容:
调用: fun(libname, pkgname)
错误: 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.
错误: ‘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.
My system is OS X El Capitan 10.11.5
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
Java Path
$ which java
/usr/bin/java
R version
R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)
I have tried the following, basically setting path and java environment in vi profile:
rJava load error in RStudio/R after "upgrading" to OSX Yosemite
Cannot load R xlsx package on Mac OS 10.11
R: rJava package install failing
But I still cannot load library(OpenStreetMap) and got the warning messages above. p.s. I can load library(rJava) without problem.
Also, when I tried to install jvm packages, it shows:
package ‘jvm’ is not available (for R version 3.3.0)
Could anyone help shed some light on this question? Have been struggling with this issue for hours, and thanks sooooo much for your help.
I don't understand but it suddenly worked. But I could not load the map correctly:
> library(OpenStreetMap)
> map <- openmap(c(41,100),c(21,125),zoom=5,type = "osm")
There were 16 warnings (use warnings() to see them)
> warnings()
警告信息:
1: In `[<-`(`*tmp*`, i, value = <S4 object of class structure("RasterStack", package = "raster")>) :
implicit list embedding of S4 objects is deprecated
2: In `[<-`(`*tmp*`, i, value = <S4 object of class structure("RasterStack", package = "raster")>) :
implicit list embedding of S4 objects is deprecated
Also, I have installed packages("raster").