[R-SIG-Mac] rJava stops loading since I upgraded R to 3.4.0

Brandon Hurr brandon.hurr at gmail.com
Wed May 24 17:21:48 CEST 2017


xcode-select --install

And see if you have the command line tools installed.

Brandon

On Wed, May 24, 2017 at 8:19 AM, David Winsemius <dwinsemius at comcast.net>
wrote:

>
> > On May 24, 2017, at 7:40 AM, Christofer Bogaso <
> bogaso.christofer at gmail.com> wrote:
> >
> > Hi,
> >
> > I have installed javac to it's latest version, still the problem
> > persists. Below is the latest result
> >
> >> library(rJava)
> >
> > 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
> >
> >> file.exists('/Library/Frameworks/R.framework/Versions/3.4/Resources/
> library/rJava/libs/rJava.so')
> >
> > [1] TRUE
> >
> >> system('javac -version')
> >
> > javac 1.8.0_131
> >
> >
> > Also, when I ran 'sudo R CMD javareconf' in my Terminal, I got below
> result :
> >
> > dyld: Library not loaded:
> > @rpath/DVTFoundation.framework/Versions/A/DVTFoundation
> >
> >  Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/
> xcodebuild
> >
> >  Reason: no suitable image found.  Did find:
> >
> > /Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation:
> > cannot load '/Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation'
> > because Objective-C garbage collection is not supported
> >
> > xcrun: error: unable to locate xcodebuild, please make sure the path
> > to the Xcode folder is set correctly!
> >
> > xcrun: error: You can set the path to the Xcode folder using
> > /usr/bin/xcode-select -switch
>
> So did you follow the advice in the error messages? I interpret this to
> suggest you didn't update Xcode when you updated to Sierra.
>
> --
> David.
>
>
> >
> > dyld: Library not loaded:
> > @rpath/DVTFoundation.framework/Versions/A/DVTFoundation
> >
> >  Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/
> xcodebuild
> >
> >  Reason: no suitable image found.  Did find:
> >
> > /Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation:
> > cannot load '/Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation'
> > because Objective-C garbage collection is not supported
> >
> > xcrun: error: unable to locate xcodebuild, please make sure the path
> > to the Xcode folder is set correctly!
> >
> > xcrun: error: You can set the path to the Xcode folder using
> > /usr/bin/xcode-select -switch
> >
> > dyld: Library not loaded:
> > @rpath/DVTFoundation.framework/Versions/A/DVTFoundation
> >
> >  Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/
> xcodebuild
> >
> >  Reason: no suitable image found.  Did find:
> >
> > /Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation:
> > cannot load '/Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation'
> > because Objective-C garbage collection is not supported
> >
> > xcrun: error: unable to locate xcodebuild, please make sure the path
> > to the Xcode folder is set correctly!
> >
> > xcrun: error: You can set the path to the Xcode folder using
> > /usr/bin/xcode-select -switch
> >
> > dyld: Library not loaded:
> > @rpath/DVTFoundation.framework/Versions/A/DVTFoundation
> >
> >  Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/
> xcodebuild
> >
> >  Reason: no suitable image found.  Did find:
> >
> > /Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation:
> > cannot load '/Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation'
> > because Objective-C garbage collection is not supported
> >
> > xcrun: error: unable to locate xcodebuild, please make sure the path
> > to the Xcode folder is set correctly!
> >
> > xcrun: error: You can set the path to the Xcode folder using
> > /usr/bin/xcode-select -switch
> >
> > dyld: Library not loaded:
> > @rpath/DVTFoundation.framework/Versions/A/DVTFoundation
> >
> >  Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/
> xcodebuild
> >
> >  Reason: no suitable image found.  Did find:
> >
> > /Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation:
> > cannot load '/Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation'
> > because Objective-C garbage collection is not supported
> >
> > xcrun: error: unable to locate xcodebuild, please make sure the path
> > to the Xcode folder is set correctly!
> >
> > xcrun: error: You can set the path to the Xcode folder using
> > /usr/bin/xcode-select -switch
> >
> > dyld: Library not loaded:
> > @rpath/DVTFoundation.framework/Versions/A/DVTFoundation
> >
> >  Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/
> xcodebuild
> >
> >  Reason: no suitable image found.  Did find:
> >
> > /Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation:
> > cannot load '/Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation'
> > because Objective-C garbage collection is not supported
> >
> > xcrun: error: unable to locate xcodebuild, please make sure the path
> > to the Xcode folder is set correctly!
> >
> > xcrun: error: You can set the path to the Xcode folder using
> > /usr/bin/xcode-select -switch
> >
> > Java interpreter : /usr/bin/java
> >
> > Java version     : 1.8.0_131
> >
> > Java home path   :
> > /Library/Java/JavaVirtualMachines/jdk1.8.0_131.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 macOS
> >
> >
> > 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/Users/ARRUN/Library/Java/Extensions
> > -L/Library/Java/Extensions -L/Network/Library/Java/Extensions
> > -L/System/Library/Java/Extensions -L/usr/lib/java -L. -ljvm
> >
> > dyld: Library not loaded:
> > @rpath/DVTFoundation.framework/Versions/A/DVTFoundation
> >
> >  Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/
> xcodebuild
> >
> >  Reason: no suitable image found.  Did find:
> >
> > /Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation:
> > cannot load '/Applications/Xcode.app/Contents/Developer/usr/bin/../
> ../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation'
> > because Objective-C garbage collection is not supported
> >
> > xcrun: error: unable to locate xcodebuild, please make sure the path
> > to the Xcode folder is set correctly!
> >
> > xcrun: error: You can set the path to the Xcode folder using
> > /usr/bin/xcode-select -switch
> >
> > Unable to compile a JNI program
> >
> >
> >
> > JAVA_HOME        :
> > /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre
> >
> > Java library path:
> >
> > JNI cpp flags    :
> >
> > JNI linker flags :
> >
> > Updating Java configuration in /Library/Frameworks/R.framework/Resources
> >
> > Done.
> >
> > On Wed, May 24, 2017 at 10:28 AM, Simon Urbanek
> > <simon.urbanek at r-project.org> wrote:
> >> Christofer,
> >>
> >>> On May 23, 2017, at 7:44 PM, Christofer Bogaso <
> bogaso.christofer at gmail.com> wrote:
> >>>
> >>> Hi David,
> >>>
> >>> The file 'rJava.so' exists in my machine :
> >>>
> >>>> file.exists('/Library/Frameworks/R.framework/Versions/3.4/Resources/
> library/rJava/libs/rJava.so')
> >>>
> >>> [1] TRUE
> >>>
> >>> Also the Javac version that I have :
> >>>
> >>>> system('javac -version')
> >>>
> >>> javac 1.6.0_65
> >>>
> >>> Looks like mine is older than you. Do I need to download the latest?
> >>> In that case, do you suggest any link? As far as I know, javac comes
> >>> with Mac installed.
> >>>
> >>
> >> Apple has dropped Java support many years ago - what you have a is a
> left-over from a very old OS X version as you likely upgraded your OS X
> over the years without re-installing.
> >> Since R 3.4.0 the CRAN binary uses Java 1.8, because too many users
> have complained about incompatibilities with old Java version, so you have
> two options
> >> 1) recompile rJava from sources against your ancient Java
> >> 2) install Java 1.8 from Oracle[1], then run R CMD javareconf
> >>
> >> [1] http://www.oracle.com/technetwork/java/javase/
> downloads/jdk8-downloads-2133151.html
> >>
> >> Cheers,
> >> Simon
> >>
> >>
> >>
> >>> On Peter's suggestion I also did sudo R CMD javareconf. However still
> >>> rJava couldnt be loaded.
> >>>
> >>> Any other idea? Thanks,
> >>>
> >>> On Wed, May 24, 2017 at 4:28 AM, peter dalgaard <pdalgd at gmail.com>
> wrote:
> >>>> [Christofer seemed to have fallen off the cc: list, now included]
> >>>>
> >>>>> On 24 May 2017, at 00:18 , David Winsemius <dwinsemius at comcast.net>
> wrote:
> >>>>>
> >>>>> What version of the Java Runtime Environment is available? What do
> you get for:
> >>>>>
> >>>>> system('javac -version')
> >>>>> #I get:
> >>>>> #javac 1.8.0_65
> >>>>>
> >>>>> I think that version was working with rJava, but I followed the
> "critical" advice on the Java SDK webpage ...
> >>>>>
> >>>>> ... and after updating I now  get
> >>>>> #javac 1.8.0_131
> >>>>>
> >>>>> And rJava still loads without error. I'm not on Sierra, however.
> >>>>>
> >>>>
> >>>> I am, and rJava doesn't load here either. However after
> >>>>
> >>>> sudo R CMD javareconf
> >>>>
> >>>> it seems happy as a clam.
> >>>>
> >>>>
> >>>>> Good luck;
> >>>>> David,
> >>>>
> >>>> --
> >>>> Peter Dalgaard, Professor,
> >>>> Center for Statistics, Copenhagen Business School
> >>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> >>>> Phone: (+45)38153501
> >>>> Office: A 4.23
> >>>> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>> _______________________________________________
> >>> 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
>
> David Winsemius
> Alameda, CA, USA
>
> _______________________________________________
> 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