Search code examples
javaeclipsestanford-nlp

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space


I'm using Eclipse to run java program class, while I run it i got this error

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

then i changed the VM from the Properties > Run > VM Options, and I run the program again i got a new error,

Error occurred during initialization of VM
Incompatible initial and maximum heap sizes specified

I'm trying to apply stanford libraries in my program, any idea how to solve this error .


Solution

  • to change the VM for Eclipse you can change the amount of the MV from Windows> Preferences> Java> Installed JREs from there select the JRE and click edit, then write in the Default VM Arguments: to -Xmx1024M or any other amount of memory ...