这是一个 32 位的 Ubuntu 操作系统
rob@laptop:~$ uname -a
Linux laptop 3.5.0-37-generic #58~precise1-Ubuntu SMP Wed Jul
10 17:51:56 UTC 2013 i686 i686 i386 GNU/Linux
rob@laptop:~$ java -version
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
OpenJDK Server VM (build 23.7-b01, mixed mode)
rob@laptop:~$ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
0 /usr/lib/j2re1.6-ibm/jre/bin/java 1200 auto mode
1 /home/rob/Downloads/jre1.7.0_25/bin/java 1 manual mode
2 /usr/lib/j2re1.6-ibm/jre/bin/java 1200 manual mode
* 3 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1051 manual mode
我希望能够运行超过 2g 的堆
rob@laptop:~$ java -Xmx3g -jar tool.jar
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
rob@laptop:~$ free -g
total used free shared buffers cached
Mem: 15 2 12 0 0 1