title: build R package failing with rJava LoadLibrary "not a valid win32 application" failure
body: <p>I wrote an R package to connect R with messageQueues, specifically activeMQ and rabbitMQ, so all the source can be found here: <a href="http://r-forge.r-project.org/projects/r-message-queue/" rel="nofollow">http://r-forge.r-project.org/projects/r-message-queue/</a></p>
  
  <p>r-forge fails to build the package, so I'm recreating/debugging locally, but my local build fails earlier in the process than r-forge.</p>
  
  <p>I'm running 64bit windows7, 64bit R v2.15.2.<br>
  If I'm going about this the wrong way, let me know.</p>
  
  <p><strong>BUILDING the R package</strong></p>
  
  <pre><code>$ R --verbose CMD build messageQueue
  * checking for file 'messageQueue/DESCRIPTION' ... OK
  * preparing 'messageQueue':
  * checking DESCRIPTION meta-information ... OK
  * checking for LF line-endings in source and make files
  * checking for empty or unneeded directories
  * building 'messageQueue_0.1.tar.gz'
  cygwin warning:
    MS-DOS style path detected: C:/Users/msm336/workspace_r/messageQueue_0.1.tar.gz
    Preferred POSIX equivalent is: /cygdrive/c/Users/msm336/workspace_r/messageQueue_0.1.tar.gz
    CYGWIN environment variable option "nodosfilewarning" turns off this warning.
    Consult the user's guide for more details about POSIX paths:
      http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
  </code></pre>
  
  <p><strong>CHECKING the R package</strong></p>
  
  <pre><code>$ R --verbose CMD check messageQueue_0.1.tar.gz
  * using log directory 'C:/Users/msm336/workspace_r/messageQueue.Rcheck'
  * using R version 2.15.2 (2012-10-26)
  * using platform: x86_64-w64-mingw32 (64-bit)
  * using session charset: ISO8859-1
  * checking for file 'messageQueue/DESCRIPTION' ... OK
  * checking extension type ... Package
  * this is package 'messageQueue' version '0.1'
  * checking package namespace information ... OK
  * checking package dependencies ... OK
  * checking if this is a source package ... OK
  * checking if there is a namespace ... OK
  * checking for executable files ... OK
  * checking whether package 'messageQueue' can be installed ... ERROR
  Installation failed.
  See 'C:/Users/msm336/workspace_r/messageQueue.Rcheck/00install.out' for details.
  </code></pre>
  
  <p><strong>CONTENTS of messageQueue.Rcheck/00install.out</strong></p>
  
  <pre><code>* installing *source* package 'messageQueue' ...
  ** R
  ** inst
  ** preparing package for lazy loading
  ** help
  *** installing help indices
  ** building package indices
  ** testing if installed package can be loaded
  *** arch - i386
  Error : .onLoad failed in loadNamespace() for 'rJava', details:
    call: inDL(x, as.logical(local), as.logical(now), ...)
    error: unable to load shared object 'C:/Program Files/R/R-2.15.2/library/rJava/libs/i386/rJava.dll':
    LoadLibrary failure:  %1 is not a valid Win32 application.
  
  Error : package 'rJava' could not be loaded
  Error: loading failed
  Execution halted
  *** arch - x64
  ERROR: loading failed for 'i386'
  * removing 'C:/Users/msm336/workspace_r/messageQueue.Rcheck/messageQueue'
  </code></pre>
  
  <p>I'm not sure why it's trying to load the i386 version of rJava, when I'm running x64 R on Windows7 x64 using a 64bit version of java:</p>
  
  <pre><code>$ java -version
  java version "1.7.0_04"
  Java(TM) SE Runtime Environment (build 1.7.0_04-b22)
  Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)
  </code></pre>
  
  <p>I've also got the JAVA_HOME/jre/bin/server/jvm.dll on my path, because rJava likes that somehow.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks,</p>
  
  <p>Matt.</p>