How to set the -Xmx when start running a jar file?

后端 未结 5 1922
青春惊慌失措
青春惊慌失措 2020-12-13 12:36

As we know that we can set -Xmx1024M in window->preferences->java->installed jres->edit->default vm arguments in eclipse

5条回答
  •  [愿得一人]
    2020-12-13 13:34

    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.

提交回复
热议问题