title: Loading R package xlsx: Error : .onLoad failed in loadNamespace()
body: <p>I tried to load the R package xlsx:</p>
  
  <pre><code>library('xlsx')
  </code></pre>
  
  <p>But I got the following error:</p>
  
  <pre><code>Error : .onLoad failed in loadNamespace() for 'xlsx', details:
    call: .jinit()
    error: Cannot create Java virtual machine (-1)
  In addition: Warning message:
  package ‘xlsx’ was built under R version 3.2.3 
  Error: package or namespace load failed for ‘xlsx’
  </code></pre>
  
  <p>My R-session aborts when I try .jinit()</p>
  
  <p>Any help is much appreciated.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I updated R Studio to the newest version and executed </p>
  
  <pre><code>update.packages(checkBuilt = TRUE)
  </code></pre>
  
  <p>but still got the following error:</p>
  
  <pre><code>Error : .onLoad failed in loadNamespace() for 'xlsx', details:
    call: .jinit()
    error: Cannot create Java virtual machine (-1)
  Error: package or namespace load failed for ‘xlsx’
  </code></pre>
  
  <p><strong>Edit 2:</strong></p>
  
  <p>This question is still unsolved. 
  As Pascal in the comments below suggested I looked for the windows equivalent command of:</p>
  
  <pre><code>R CMD javareconf
  </code></pre>
  
  <p>After many hours of searching I still didn't found it. </p>