[转]怎样用Java运行64位程序

本文地址为:http://hi.baidu.com/%B0%AE%D0%C4%CD%AC%C3%CB_%B3%C2%F6%CE/blog/item/b57212b4f76c3f798bd4b2f1.html

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经过我的测试)

posted @ 2011-12-16 02:28  Alex~  阅读(4180)  评论(0编辑  收藏  举报