Increasing Java Heap Size

前端 未结 6 1704
死守一世寂寞
死守一世寂寞 2021-01-28 02:43

I\'m trying to increase value of heap size of my jvm, but it doesn\'t work. Could anybody help me with this geek problem? My configuration are follow: Windows 7 x64, 4 GB, i3 CP

相关标签:
6条回答
  • 2021-01-28 03:05

    Your command is half correct. You need to specify what you want to run with an increased heap size. Something like this

    java -Xmx2000M -Xms1000M -jar <jar-file-name>.jar
    
    0 讨论(0)
  • 2021-01-28 03:11

    you need to specify as well which class/jar you want to run. You cannot just increase the heap size per default for all java pplications. Instead you have to edit the command line of the program you are trying to run.

    0 讨论(0)
  • 2021-01-28 03:20

    I think you are expecting this.

    $ java -Xmx2000M -Xms1000M -XshowSettings:all

    VM settings:
       Min. Heap Size: 1000.00M
       Max. Heap Size: 1.95G
       Ergonomics Machine Class: server
       Using VM: Java HotSpot(TM) 64-Bit Server VM
    
    0 讨论(0)
  • 2021-01-28 03:24

    may be I am late) But I think you can use it. In IDEA choose Edit Configuration... on drop-down list(look on picture below). And then type in VM Options your parameters -Xmx2000M -Xms1000M. How to find Edit Configuration on IDEA

    0 讨论(0)
  • 2021-01-28 03:25

    The error you have got in the last screen shot is about unavailability of the class file to run.
    You should provide class file which includes main function while running java command.

    java -Xmx2000M -Xms1000m MyClass
    

    Considering you have MyClass.class in your classpath.

    0 讨论(0)
  • 2021-01-28 03:26

    You need to provide something for JVM to run with these new settings.

    The arguments you are using only configure the JVM, it still needs whatever jar or class file you want to run.

    To permanently configure JVM profile on windows, follow these Instructions. The settings tool will let you edit runtime parameters:

    enter image description here

    0 讨论(0)
提交回复
热议问题