Sunday, June 26, 2016

“Java heap space” error in eclipse (Windows 7)

Little background : I am currently working in a project based on Eclipse RCP.  In this project whenever i need to setup a new work-space or dependency of my project change i need to resolve the target.

During resolving the target i was getting the  “Java heap space error in eclipse" frequently : i have tried different solution from web but i it never worked. specially changing the JVM argument in the eclipse.ini file never worked for me.

Fist of all i did not know how to check  current JVM min and max heap size. after googling i have found this nice tool which come by-default with JDK .

JConsole : 
Using JConsole you can check the current minimum and maximum head size alocated in the JVM for a program or process:

Please check the below link for details
http://docs.oracle.com/javase/7/docs/technotes/guides/management/jconsole.html



Now i know how much heap size is allocated currently: so i need to increase the heap size.
For increasing the heap size i have done the following  :

Try setting a Windows System Environment variable called _JAVA_OPTIONS with the heap size you want. Java should be able to find it and act accordingly.






 setting windows  system  env variable _JAVA_OPTIONS as -Xms2048m -Xmx4096m -XX:MaxPermSize=1024m


works for me  :)



No comments:

Post a Comment

5 Strategies for Getting More Work Done in Less Time

Summary.    You’ve got more to do than could possibly get done with your current work style. You’ve prioritized. You’ve planned. You’ve dele...