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)

