So you are gettingjava.lang.OutOfMemoryError:Java heap space and
run out of ideas on what to do, especially if you are user of any Java
application and not the programmer or developer, this could be a tricky
situation to be in. I receive lots of emails from Minecraft user ( a
popular Java game), along with junior developers who are using Tomcat,
JBoss, Websphere, Android user, who uses Android apps and several other
Swing based Java desktop application user complaining about java.lang.OutOfMemoryError:Java heap space in
there Mobile or Laptop. For users, there is not much they can do, but
to restart the application. When you restart your application, previous
memory get reclaimed by OS and it's a fresh start for your application,
but you may lose data, which is not saved, especially if you are playing
Java games like Minecraft. For Junior programmers, they have some
options, but hey need to understand that all this web and application
server and IDEs like Eclipse, IntelliJ and Netbeans are Java programs
and can be configured to run with more memory. You just need to find
out there startup script, from where they are launching java command
to start the process and modify value of -Xmx JVM option to a higher
value, subject to your machine configuration or simply add -Xmx JVM
option if it's not already there. Before doing this it's better to
understand some basics about Java Heap memory, why java.lang.OutOfMemoryError:Java heap space comes and what are JVM option to fix this error.