title: Cannot load a package - Have tried all dependencies
body: <p>I can't seem to find a solution for this error: </p>
  
  <pre><code>&gt; install.packages("devtools")
  Installing package into ‘C:/Users/rawlingsD/Documents/R/win-library/3.4’
  (as ‘lib’ is unspecified)
  also installing the dependencies ‘memoise’, ‘git2r’
  
  trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/memoise_1.1.0.zip'
  Content type 'application/zip' length 29955 bytes (29 KB)
  downloaded 29 KB
  
  trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/git2r_0.21.0.zip'
  Content type 'application/zip' length 3029324 bytes (2.9 MB)
  downloaded 2.9 MB
  
  trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/devtools_1.13.5.zip'
  Content type 'application/zip' length 443954 bytes (433 KB)
  downloaded 433 KB
  
  package ‘memoise’ successfully unpacked and MD5 sums checked
  package ‘git2r’ successfully unpacked and MD5 sums checked
  package ‘devtools’ successfully unpacked and MD5 sums checked
  
  The downloaded binary packages are in
      C:\Users\rawlingsD\AppData\Local\Temp\Rtmpag2PO3\downloaded_packages
  &gt; devtools::install_github("kassambara/r2excel")
  Downloading GitHub repo kassambara/r2excel@master
  from URL https://api.github.com/repos/kassambara/r2excel/zipball/master
  Installing r2excel
  "C:/PROGRA~1/R/R-34~1.4/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
    "C:/Users/rawlingsD/AppData/Local/Temp/Rtmpag2PO3/devtools232469f6118a/kassambara-r2excel-4144fc5"  \
    --library="C:/Users/rawlingsD/Documents/R/win-library/3.4" --install-tests 
  
  * installing *source* package 'r2excel' ...
  ** R
  ** preparing package for lazy loading
  Error: package or namespace load failed for 'rJava':
   .onLoad failed in loadNamespace() for 'rJava', details:
    call: fun(libname, pkgname)
    error: JAVA_HOME cannot be determined from the Registry
  Error : package 'rJava' could not be loaded
  ERROR: lazy loading failed for package 'r2excel'
  * removing 'C:/Users/rawlingsD/Documents/R/win-library/3.4/r2excel'
  In R CMD INSTALL
  </code></pre>
  
  <p>I have tried loading rJava seperately and this seems to be causing the issue, I have installed from a tar.gz file from rStudio as well as directly from the CRAN, however, neither have worked unfortuantely!</p>
  
  <p>Thank you in advance for your help!</p>
  
  <p>Still not resolved after redownloading Java x64, and trialling the line: </p>
  
  <pre><code>Sys.setenv(JAVA_HOME="C://Program Files//Java//jre1.8.0_161")
  </code></pre>
  
  <p>These were suggestions on another question, I am using Windows 10 and have the error below:</p>
  
  <pre><code>Error: package or namespace load failed for 'rJava':
   .onLoad failed in loadNamespace() for 'rJava', details:
    call: inDL(x, as.logical(local), as.logical(now), ...)
    error: unable to load shared object 'C:/Users/rawlingsD/Documents/R/win-library/3.4/rJava/libs/i386/rJava.dll':
    LoadLibrary failure:  %1 is not a valid Win32 application.
  </code></pre>
  
  <p>Thanks again for any help</p>