怎样用Java运行64位程序

32位下JVM最大可用内存<4g
$  java -showversion -Xmx4g HelloWorld
Invalid maximum heap size: -Xmx6g
The specified size exceeds the maximum representable size.
Could not create the Java virtual machine.

所需内存超过4g,需开启64位标记
$   java -showversion  -d64   -Xmx6g HelloWorld
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b04)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)

Hello world!

系统平台不支持64位时会提示:
Running a 64-bit JVM is not supported on this platform.

物理内存不够时会提示:
Error occorred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.


p.s. 开启64位标记在Linux下使用-d,win32下使用-D。(linux jdk1.5,1.6; win32 jdk1.6经过我的测试)

你可能感兴趣的:(jdk,64位)