Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.OutOfMemoryError: Java heap space

 
J Vazquez
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the following code to get ImageIcons from files on my computer to display on jbuttons. After about 4(80x60) images are displayed on my JPanel, I get this error

java.lang.OutOfMemoryError: Java heap space




Any Ideas on what can be done? I read about increasing the memory via the commandline, if this is the case, how do I incorporate that into my program if I plan on distributing it to friends? Thanks
-Juan
 
Steven Wall
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are distributing your application via Java WebStart, in your JNLP file, there is a <j2se> node that is child node of <resources>. On the <j2se> node, there is an attribute for "max-heap-size". You can set the client heap size there.

For example:
 
J Vazquez
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone see an error in this.. I am running this on os 10.5 if that matters.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic