title: Java: Error occurred during initialization of VM
body: <p>I am trying to adjust ram sharing correctly but there is a problem. I tested some solutions from stackoverflow on my server but I achieved no result. When I run this command, there is no problem.</p>
  
  <pre><code>export _JAVA_OPTIONS='-Xms16m -Xmx64m'
  </code></pre>
  
  <p>Then I run <code>java -version</code> from command prompt:</p>
  
  <pre><code>Picked up _JAVA_OPTIONS: -Xms16m -Xmx64m
  java version "1.7.0_95"
  OpenJDK Runtime Environment (rhel-2.6.4.0.el6_7-x86_64 u95-b00)
  OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
  </code></pre>
  
  <p>However, I want to increase size with this command but it cannot execute:</p>
  
  <pre><code> export _JAVA_OPTIONS='-Xms16m -Xmx128m'
  </code></pre>
  
  <p>After above command, when I run <code>java -version</code> again, I have this error:</p>
  
  <pre><code>Picked up _JAVA_OPTIONS: -Xms16m -Xmx128m
  Error occurred during initialization of VM
  Cannot create VM thread. Out of system resources.
  </code></pre>
  
  <p>This is output of <code>free -m</code>:</p>
  
  <pre><code>             total       used       free     shared    buffers     cached
  Mem:          2048        961       1086          6          0        397
  -/+ buffers/cache:        564       1483
  Swap:            0          0          0
  </code></pre>
  
  <p>If the problem is inability of RAM of my server, I upgraded to 2 gb from 1 gb before. How much longer do I have to upgrade it to run Java correctly? What should I do? </p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Here is output of <code>ulimit -a</code>:</p>
  
  <pre><code>core file size          (blocks, -c) 0
  data seg size           (kbytes, -d) unlimited
  scheduling priority             (-e) 0
  file size               (blocks, -f) unlimited
  pending signals                 (-i) 1030823
  max locked memory       (kbytes, -l) 64
  max memory size         (kbytes, -m) 524288
  open files                      (-n) 1024
  pipe size            (512 bytes, -p) 8
  POSIX message queues     (bytes, -q) 819200
  real-time priority              (-r) 0
  stack size              (kbytes, -s) 10240
  cpu time               (seconds, -t) unlimited
  max user processes              (-u) 1030823
  virtual memory          (kbytes, -v) 524288
  file locks                      (-x) unlimited
  </code></pre>