Could not reserve enough space for object heap

后端 未结 26 1359
余生分开走
余生分开走 2020-11-22 05:59

I am getting the following exception repeatedly each time I try to run the program.

Error occurred during initialization of VM

Could not reserve e

26条回答
  •  遥遥无期
    2020-11-22 06:39

    Suppose your class is called Test in package mypackage. Run your code like this:

    java -Xmx1024m mypackage.Test
    

    This will reserve 1024 MB of heap space for your code. If you want 512 MB, you can use:

    java -Xmx512m mypackage.Test
    

    Use little m in 1024m, 512m, etc

提交回复
热议问题