• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

BlueJ Error Message Please Help

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have stumbled across a problem and I am not sure if it relates to BlueJ or the program I am writing.

In class MapDisplay (line 13), if imageSize is set to 1888 or higher, the following error message appears.

An exception was thrown:
Internal BlueJ error: unexpected exception in remote VM
java.lang.ArrayIndexOutOfBoundsException: 0

The reason I think it may be a bug in BlueJ is due to the Internal BlueJ error reference in the error message,

The Terminal window displays "java.lang.OutOfMemoryException"

If imageSize is set to 1887 or lower, no error message is shown.

I have enclosed the java files - could you tell me if this is a BlueJ bug (and how to report it - I looked at BugZilla but I didn't understand it at all) or if this is my own programs bug, can someone tell me what I am doing wrong.

Thank you for your time and help.

Darren

 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like you are getting an Out of Memory Exception. Try increasing the amount of memory available to your program.
 
D R Wilkinson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply :-)

How do I increase the memory available to my program?

Also, why would the program be running out of memory? Are the BufferedImage's I am creating too large? Is there a better way to create a less memory hungry offscreen image buffer?

Why I am also getting a java.lang.ArrayIndexOutOfBoundsException? I am not sure where in my program this is happening?
[ November 18, 2004: Message edited by: D R Wilkinson ]
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

How do I increase the memory available to my program?


It's a runtime parameter to the program. The way to do that is IDE specific so I'll defer to someone who has used this IDE.

Also, why would the program be running out of memory? Are the BufferedImage's I am creating too large? Is there a better way to create a less memory hungry offscreen image buffer?


It looks like you create four copies of this image buffer to read the same image. That would eat up more memory than necessary. You could share references to this buffer (by passing it as a parameter.)

Why I am also getting a java.lang.ArrayIndexOutOfBoundsException? I am not sure where in my program this is happening?


Your code is throwing an OutOfMemory error. You are correct that there is a bug in the IDE. Instead of gracefully telling you that the program is using too much memory, it is throwing an ArrayIndexOutOfBoundsException.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric describes the command to increase memory. It's the same command. You just need to figure out how to it for your IDE.
 
D R Wilkinson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much for the reply Jeanne :-)

I have worked out how to increase BlueJ's memory allocation - thanks for the pointer.

Re: The 4 BufferedImage's. I intend displaying 4 different hex maps. At the moment the maps are identical but that was just while I worked out how to actually display 4 hex maps - that done, I am working on displaying 4 different hex maps.

Are you saying that I could use one BufferedImage object for displaying all four maps?

I am guessing that this could be possible as the user can only use one map at a time (scrolling, clicking, etc) thus the single BufferedImage object could be used to display each different hex map.

Is this what you mean? If it is then I will start to work out how to use one BufferedImage object to display 4 different maps.

Again - thanks for everyones help :-)
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I meant to use one BufferedImage since it looked like four copies of the same image. Since they really are different images, you do need the four buffers.
 
D R Wilkinson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for clarifying that Jeanne. I had started to try to make it work using 1 buffer but it was starting to become confusing. I will carry on using one buffer for each map.

That said, is there a more memory efficient way of displaying these maps? Is there an alternative to using BufferedImage objects?

Again thanks for your help :-)
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure. I would suggest posting that question (about efficiency of displaying) and a code snippet in our Swing/AWT/... forum. They know much more about how to write good GUI code there.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic