Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

Thanks a lot!

question from:https://stackoverflow.com/questions/20149304/how-to-set-the-xmx-when-start-running-a-jar-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
80 views
Welcome To Ask or Share your Answers For Others

1 Answer

try java -Xmx1024m filename.

I found this on StackOverflow What does Java option -Xmx stand for? and use it when I start Netbeans for instance.

use it like this

java -Xmx1024m -jar JavaApplication.jar

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...