[R-SIG-Mac] Problem with RJDBC in OS X 10.11

Charles DiMaggio charles.dimaggio at gmail.com
Sat Jun 18 13:32:45 CEST 2016


Recently came up against the same issue with package “RNetLogo”, so appears to not be an isolated issue.  Solution for me was to 

(1) ensure latest version of java (type "java -version" without the quotes in your terminal), if less than 1.8, install Java SE Development Kit 8u91 (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) and 

(2) run the program through JGR.  I needed to tweak the settings a bit when running JGR:

Sys.setenv(NOAWT=1)
library(JGR)
Sys.unsetenv("NOAWT")
JGR()

Wasn’t entirely happy about having to leave my preferred editor (Textmate), but it worked.

Cheers

Charles
Charles DiMaggio, PhD, MPH
Professor of Surgery and Population Health
Director of Injury Research
Department of Surgery
New York University School of Medicine
462 First Avenue, NBV 15
New York, NY 10016-9196
Charles.Dimaggio at nyumc.org
Office: 212.263.3202
Mobile: 516.308.6426 





On Jun 18, 2016, at 3:43 AM, Berend Hasselman <bhh at xs4all.nl> wrote:

> 
>> On 18 Jun 2016, at 00:28, MacQueen, Don <macqueen1 at llnl.gov> wrote:
>> 
>> I’m not sure the best place to ask about this, so I’ll start here, since the problem appears to be configuring Java on a Mac to support R packages. Unfortunately, my understanding of how to configure and manage Java is essentially non-existent, so any suggestions would be much appreciated. 
>> 
>> I have a script using RJDBC that is working on a Mac running OS X 10.10.5. The same script, with the same JDBC .jar files from Oracle, is not working on an OS X 10.11.4 machine, as shown below. Other packages that depend on Java, such as xlsx, are not working either.
>> 
>> I have run R CMD javareconf to no avail (output below).
>> 
>> The software management system used by our IT department claims that "Oracle Java 1.7 SDK and JRE" are installed.
>> 
> 
> I had similar issues with rJava. See this thread: https://stat.ethz.ch/pipermail/r-sig-mac/2016-February/011836.html
> 
> I made a shell script for reinstalling rJava whenever the R version changes.
> It runs in the folder where you have the rJava source tarball.
> 
> <script>
> R -e 'Sys.getenv("DYLD_FALLBACK_LIBRARY_PATH")'
> R CMD javareconf
> R -e 'Sys.getenv("DYLD_FALLBACK_LIBRARY_PATH")'
> 
> RMAINLIB="$(R RHOME)/library"
> # install rJava from source in to main library
> R CMD INSTALL --library="$RMAINLIB" rJava_0.9-8.tar.gz > install.out
> </script>
> 
> I've just tested this after removing the installed version of rJava.
> I can load things like XLConnect etc. without problems.
> 
> Then you can use rJava etc. with R in Terminal. Using rJava doesn't work in/with R GUI.
> 
> Berend
> 
> 
>> -Don
>> 
>> 
>>> jdbm <- JDBC('oracle.jdbc.OracleDriver', '/opt/ora11g/instantclient_11_2/ojdbc6.jar', "`")
>> 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(classPath) : JNI_GetCreatedJavaVMs returned -1
>> 
>>> sessionInfo()
>> R version 3.3.0 (2016-05-03)
>> Platform: x86_64-apple-darwin13.4.0 (64-bit)
>> Running under: OS X 10.11.4 (El Capitan)
>> 
>> locale:
>> [1] C
>> 
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base     
>> 
>> other attached packages:
>> [1] RJDBC_0.2-5 rJava_0.9-8 DBI_0.4-1  
>> 
>> 
>> 
>> [macqueen1-ml:~]% sudo R CMD javareconf
>> 
>> Java interpreter : /usr/bin/java
>> Java version     : 1.7.0_101
>> Java home path   : /Library/Java/JavaVirtualMachines/jdk1.7.0_101.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$(JAVA_HOME)/lib/server -ljvm
>> clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.7.0_101.jdk/Contents/Home/jre/../include -I/Library/Java/JavaVirtualMachines/jdk1.7.0_101.jdk/Contents/Home/jre/../include/darwin -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c conftest.c -o conftest.o
>> clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk1.7.0_101.jdk/Contents/Home/jre/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
>> 
>> 
>> JAVA_HOME        : /Library/Java/JavaVirtualMachines/jdk1.7.0_101.jdk/Contents/Home/jre
>> Java library path: $(JAVA_HOME)/lib/server
>> JNI cpp flags    : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
>> JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
>> Updating Java configuration in /Library/Frameworks/R.framework/Resources
>> Done.
>> 
>> 
>> Also:
>> [macqueen1-ml:~]% java -version
>> java version "1.7.0_101"
>> Java(TM) SE Runtime Environment (build 1.7.0_101-b14)
>> Java HotSpot(TM) 64-Bit Server VM (build 24.101-b14, mixed mode)
>> 
>> 
>> 
>> Don MacQueen
>> Lawrence Livermore National Laboratory
>> macqueen1 at llnl.gov
>> 925-423-1062
>> 
>> 
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac


	[[alternative HTML version deleted]]



More information about the R-SIG-Mac mailing list