]"AWT-EventQueue-0" java.lang.OutOfMemoryError: Java Heap Space

I am writing an java application where I can drag and drop images. But what happen, while handling if it is more than 3 mb size image. It is giving an error

"AWT-EventQueue-0" java.lang.OutOfMemoryError: Java Heap Space

but try to increase the heap size also. Still I am getting the same error.

any solutions.

[348 byte] By [camsuresha] at [2007-10-2 3:29:18]
# 1
It might be possible to optimize your code to get around this. What was the maximum heap size you set so far?
RichardTheLionHearteda at 2007-7-15 22:39:03 > top of Java-index,Java Essentials,Java Programming...
# 2
java -Xms64m <filename>more this size, it is not taking any size
camsuresha at 2007-7-15 22:39:03 > top of Java-index,Java Essentials,Java Programming...
# 3
Try setting with java -Xmx
RichardTheLionHearteda at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...
# 4

Ok, now it is working for 3mb

But my clients they are telling, they have 25+ mb size one image file. Whether it will work. What is problem means I can make batch file

which contain like this(<filename>.bat):

java -Xmx256m <filename>

But what is problem means they may use this application(JAR) in Windows or Linux or MAC

Then how can I make it for JAR file.

camsuresha at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...
# 5
I'm not sure I was able to make everything out of your response.For creating a JAR file, http://java.sun.com/docs/books/tutorial/jar/basics/build.html
RichardTheLionHearteda at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...
# 6

> But my clients they are telling, they have 25+ mb

> size one image file. Whether it will work. What is

> problem means I can make batch file

You should be able to know if it works, only after testing it out with a sample 25MB image file. You could also explore into possibilities for optimization. There is a smartass around who should guide you with that.

RichardTheLionHearteda at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...
# 7
I think we can make it is a JNLP(web start) fileWhether it is possible to do it?. Then How to do it?
camsuresha at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...
# 8
how to increase the heap size dynamically depend upon the machine
camsuresha at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...
# 9
java -Xmx<size> MyClass
xHackera at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...
# 10
I have the JAR file in that dynamically heap space has to be increased.
camsuresha at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...
# 11

I have got the idea how we can increase the heap size in JAR file.

I have got the idea how we can increase the heap size in JAR file.

I have got the idea how we can increase the heap size in JAR file.

So we won't get this error

java.lang.OutOfMemoryError: Java Heap Space

camsuresha at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...
# 12
You sound like Archimedes: "Eureka!"
aniseeda at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...
# 13
Mr SureshCan You Please Tell Me How we can increase the heap size in JAR file?Regards
Java-Manoja at 2007-7-15 22:39:04 > top of Java-index,Java Essentials,Java Programming...