开始运行jar文件时如何设置-Xmx? [英] How to set the -Xmx when start running a jar file?
问题描述
我们知道我们可以在window->preferences->java->installed jres->edit->default vm arguments
中设置-Xmx1024M
> 在日食中.但是当我把这个项目打包成可运行的jar文件时,通过java -jar A.jar
运行jar时如何设置-Xmx1024M
?
As we know that we can set -Xmx1024M
in window->preferences->java->installed jres->edit->default vm arguments
in eclipse. But when I package this project into a runnable jar file, how can I set the -Xmx1024M
when running the jar via java -jar A.jar
?
非常感谢!
推荐答案
try java -Xmx1024m
文件名.
我在 StackOverflow 上找到了这个 Java 选项 -Xmx 代表什么? 并在我启动 Netbeans 时使用它.
I found this on StackOverflow What does Java option -Xmx stand for? and use it when I start Netbeans for instance.
就这样使用
java -Xmx1024m -jar JavaApplication.jar
信息:-Xmxn
指定内存分配池的最大大小(以字节为单位).该值必须是大于 2MB 的 1024 的倍数.附加字母 k 或 K 以指示千字节,或附加字母 m 或 M 以指示兆字节.默认值为 64MB.此值的上限在 Solaris 7 和 Solaris 8 SPARC 平台上约为 4000m,在 Solaris 2.6 和 x86 平台上约为 2000m,减去开销量.
info:
-Xmxn
Specify the maximum size, in bytes, of the memory allocation pool. This value must be a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. The upper limit for this value will be approximately 4000m on Solaris 7 and Solaris 8 SPARC platforms and 2000m on Solaris 2.6 and x86 platforms, minus overhead amounts.
这篇关于开始运行jar文件时如何设置-Xmx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!