简体   繁体   English

在具有8GB RAM的系统上无法设置超过4GB的XMX

[英]unable to set xmx beyond 4gb on system having 8gb RAM

I need to set 我需要设置

ANT_OPTS=-Xms1024m -Xmx6144m -XX:PermSize=1024m -XX:MaxPermSize=1024m

JAVA_OPTS=-Xms1024m -Xmx6144m -XX:PermSize=1024m -XX:MaxPermSize=1024m

I have a system with 8gb(recently upgraded from 4 gb) 我有一个8GB的系统(最近从4 GB升级)

But once i set the ant opts to above said value I am not able to run any of my ant targets and I get the following error 但是一旦我将蚂蚁设置为上述值,我将无法运行任何蚂蚁目标,并且出现以下错误

[ERROR] Argument error: -Xmx6144m
[ERROR] Specified maximum heap size (6144 MB) is larger than the address space on this platform (4 GB).
[WARN ] -XX:PermSize=1024m is not a valid VM option. Ignoring
[WARN ] -XX:MaxPermSize=1024m is not a valid VM option. Ignoring
Could not create the Java virtual machine.

This indicates the Java that I have on my system 这表明我在系统上拥有的Java

java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Oracle JRockit(R) (build R28.1.0-123-138454-1.6.0_20-20101014-1351-windows-x86_64, compiled mode)

and I am running a Windows 7 on Intel Core 2 Duo 3Ghz processor and 8GB RAM. 我在Intel Core 2 Duo 3Ghz处理器和8GB RAM上运行Windows 7。

PS: I did Google for the error and it was one of my first such occurrences where I did not get any links pointing to the specific solution. PS:我是为Google处理此错误,这是我第一次遇到此类错误,其中我没有任何指向特定解决方案的链接。

As discussed in the comments: 如评论中所述:

It would seem that your ANT installation is using a 32-bit JVM. 看来您的ANT安装正在使用32位JVM。 While a 64-bi JVM is in your PATH ANT doesn't obey the JVM in your PATH, it first looks at JAVA_HOME. 当您的PATH中有一个64-bi JVM时,ANT不会遵循您的PATH中的JVM,它将首先查看JAVA_HOME。 You can verify this by running $JAVA_HOME/bin/java -version. 您可以通过运行$ JAVA_HOME / bin / java -version进行验证。

You can update your environment to set JAVA_HOME to the 64-bit version or change the ANT script to always use a specific version of Java. 您可以更新您的环境以将JAVA_HOME设置为64位版本,或者更改ANT脚本以始终使用特定版本的Java。

The error message appears to be suggesting the platform is 32-bit. 错误消息似乎表明该平台是32位。 I imagine you can't actually use 4 GB. 我想您实际上不能使用4 GB。

I would try installing the 64-bit version of Java and using that. 我会尝试安装Java的64位版本并使用它。


For the HotSpot JVM I would expect to see 对于HotSpot JVM,我希望看到

$ java -mx30g -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM