简体   繁体   English

JVM堆内存

[英]JVM heap memory

Do we need to mandatory specify JVM heap memory arguments in bat file while calling .jar file? 在调用.jar文件时,是否需要在bat文件中强制指定JVM堆内存参数?

For example: start /b "" "jre7\\bin\\javaw.exe" -Xmx1G -jar XYZ.jar 例如:start / b“”“ jre7 \\ bin \\ javaw.exe” -Xmx1G -jar XYZ.jar

I have the scenario that in some machine when I explicitly specify the arguments(as above) then Java fatal exception is generated! 我有一种情况,在某些机器上,当我明确指定参数(如上)时,就会生成Java致命异常!

enter image description here 在此处输入图片说明

Error Message: "Java virtual machine Launcher: Error: Could not create Java virtual machine. Error: A fatal exception has occurred. Program will exit." 错误消息:“ Java虚拟机启动器:错误:无法创建Java虚拟机。错误:发生致命异常。程序将退出。”

But when I remove the arguments then no error is reported. 但是,当我删除参数时,没有错误报告。 Please anyone let me know. 请任何人让我知道。 Thank you. 谢谢。

You need to update the windows environment variables _JAVA_OPTIONS and set Xmx1024M there. 您需要更新Windows环境变量_JAVA_OPTIONS并在那里设置Xmx1024M。 Once done you can start your JVM just fine. 完成后,就可以启动JVM了。

Xmx is an optional argument that specifies the maximum heap size that can be used by Java. Xmx是一个可选参数,它指定Java可以使用的最大堆大小。 It is not required. 不需要。

If you specify too large a number, you may get a fatal exception. 如果指定的数字太大,则可能会出现致命异常。 If you don't specify an option, java chooses the max heap size. 如果不指定选项,则java选择最大堆大小。 You can find the default value of this on linux by running 'java -XX:+PrintFlagsFinal -version | 您可以通过运行'java -XX:+ PrintFlagsFinal -version |在Linux上找到它的默认值。 grep MaxHeapSize' grep MaxHeapSize'

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

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