I am setting image to Label and before that I am creating ImageIcon Object
ImageIcon icon=new ImageIcon(PathToImage,"Image");
jLabel.setIcon(icon);
wh开发者_JAVA百科en image size exceeding 4 MB i am getting "java.lang.OutOfMemoryError: Java heap space"
Is this error related to image size or something else?
If it is by large image size then any possible workaround ?
Try adding these JVM parameters at run time:
java -Xms256m -Xmx512m
That will increase the available memory to your program.
精彩评论