r - .onLoad failed in loadNamespace() for 'rJava' when installing a package -


i have package "javaonloadfailed" (just minimal package testing issue, hence weird name) imports rjava. 'rjava' errors when try either check() or install() package, though require(rjava) works fine.

install() gives following errors:

> install() installing javaonloadfailed "c:/program files/r/r-3.2.0/bin/x64/r" --no-site-file --no-environ --no-save  \ --no-restore cmd install  \ "c:/projects/stackoverflow/javaonloadfailed/javaonloadfailed"  \ --library="c:/users/adb2018/documents/r/win-library/3.2" --with-keep.source  \ --install-tests   * installing *source* package 'javaonloadfailed' ... ** r ** preparing package lazy loading ** *** installing indices ** building package indices ** testing if installed package can loaded *** arch - i386 error : .onload failed in loadnamespace() 'rjava', details:   call: indl(x, as.logical(local), as.logical(now), ...)   error: unable load shared object 'c:/users/adb2018/documents/r/win-library/3.2/rjava/libs/i386/rjava.dll':   loadlibrary failure:  %1 not valid win32 application.  error: loading failed execution halted *** arch - x64 error: loading failed 'i386' * removing 'c:/users/adb2018/documents/r/win-library/3.2/javaonloadfailed' error: command failed (1) 

i using r 3.2.0 within architect, sessioninfo():

r version 3.2.0 (2015-04-16) platform: x86_64-w64-mingw32/x64 (64-bit) running under: windows 7 x64 (build 7601) service pack 1  locale: [1] lc_collate=english_united states.1252  [2] lc_ctype=english_united states.1252    [3] lc_monetary=english_united states.1252 [4] lc_numeric=c                           [5] lc_time=english_united states.1252      attached base packages: [1] stats     graphics  grdevices utils     datasets  methods   base       other attached packages: [1] devtools_1.7.0.9000 rj_2.0.3-2           loaded via namespace (and not attached): [1] tools_3.2.0   rj.gd_2.0.0-1 

the java environment variable empty

> sys.getenv('java') [1] "" 

based on suggestion, tried setting java environment variable point 64 bit version of java (because running r 64 bit, see sessioninfo, doesn't work:

> sys.setenv(java_home='c:\\program files\\java\\jre1.8.0_45') > install() installing javaonloadfailed "c:/program files/r/r-3.2.0/bin/x64/r" --no-site-file --no-environ --no-save  \   --no-restore cmd install  \   "c:/projects/stackoverflow/javaonloadfailed/javaonloadfailed"  \   --library="c:/users/adb2018/documents/r/win-library/3.2" --with-keep.source  \   --install-tests   * installing *source* package 'javaonloadfailed' ... ** r ** preparing package lazy loading ** *** installing indices ** building package indices ** testing if installed package can loaded *** arch - i386 error : .onload failed in loadnamespace() 'rjava', details:   call: indl(x, as.logical(local), as.logical(now), ...)   error: unable load shared object 'c:/users/adb2018/documents/r/win-library/3.2/rjava/libs/i386/rjava.dll':   loadlibrary failure:  %1 not valid win32 application.  error: loading failed execution halted *** arch - x64 error: loading failed 'i386' * removing 'c:/users/adb2018/documents/r/win-library/3.2/javaonloadfailed' error: command failed (1) 

i tried set java environment variable such points 32 bit version of java on system, , works!

> sys.setenv(java_home='c:\\program files (x86)\\java\\jre1.8.0_45\\') > install() installing javaonloadfailed "c:/program files/r/r-3.2.0/bin/x64/r" --no-site-file --no-environ --no-save  \   --no-restore cmd install  \   "c:/projects/stackoverflow/javaonloadfailed/javaonloadfailed"  \   --library="c:/users/adb2018/documents/r/win-library/3.2" --with-keep.source  \   --install-tests   * installing *source* package 'javaonloadfailed' ... ** r ** preparing package lazy loading ** *** installing indices ** building package indices ** testing if installed package can loaded *** arch - i386 *** arch - x64 * done (javaonloadfailed)  [info] updating r environment index started...  [info] r environment index updated successfully. 

i don't quite understand why need point java 32 bit make r 64 bit work, that's seems case.

by way, don't stumble on package name "javaonloadfailed". created minimal package name test problem.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -