GeeCON Prague 2014*
The moose likes IDEs, Version Control and other tools and the fly likes BlueJ Error Message Please Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "BlueJ Error Message Please Help" Watch "BlueJ Error Message Please Help" New topic
Author

BlueJ Error Message Please Help

D R Wilkinson
Ranch Hand

Joined: Oct 29, 2004
Posts: 51
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

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

It looks like you are getting an Out of Memory Exception. Try increasing the amount of memory available to your program.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
D R Wilkinson
Ranch Hand

Joined: Oct 29, 2004
Posts: 51
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
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

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
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

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

Joined: Oct 29, 2004
Posts: 51
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
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

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

Joined: Oct 29, 2004
Posts: 51
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
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

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.
 
GeeCON Prague 2014
 
subject: BlueJ Error Message Please Help