Exception in thread

I have developed a gallery programme which was working nicely with a few pictures i had but now that i have increased the number of pictures i recieve an exception, Exception in thread "Image Fetcher 1" java.lang.OutOfMemoryError: Java heap space. How do i go about it.

The programme depends on an array with the ImageIcon return type like this:

private ImageIcon images[]={

new ImageIcon(getClass().getResource("media/campus.png")),

new ImageIcon(getClass().getResource("media/school.png")),

.......

}

The images in the array are about 60.

The entire exception is:

Exception in thread "Image Fetcher 1" java.lang.OutOfMemoryError: Java heap space

at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:41)

at java.awt.image.Raster.createPackedRaster(Raster.java:458)

at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)

at sun.awt.image.ImageRepresentation.createBufferedImage(ImageRepresentation.java:235)

at sun.awt.image.ImageRepresentation.setPixels(ImageRepresentation.java:487)

at sun.awt.image.ImageDecoder.setPixels(ImageDecoder.java:120)

at sun.awt.image.PNGImageDecoder.sendPixels(PNGImageDecoder.java:531)

[1268 byte] By [bartropa] at [2007-11-27 10:38:37]
# 1

Search the forums, this was asked - and answered - at least half a dozen times in the last week or so. I'm not being rude or dismissive, just efficient :)

As a pointer for the future, "Exception in thread" is a terrible subject line, it doesn't describe your problem at all, and all exceptions occur in a thread!

georgemca at 2007-7-28 18:55:38 > top of Java-index,Java Essentials,Java Programming...
# 2

i have checked but none tells me how to get a very good solution. If u have seen one that i have not seen then please point it out to me by pasting the url in your reply.

Thanks

bartropa at 2007-7-28 18:55:38 > top of Java-index,Java Essentials,Java Programming...