Forums Register Login

java.lang.OutOfMemoryError

+Pie Number of slices to send: Send
Hi,everyone!


Using JBuilder X, I worte a piece of code, which draw a red point on the screen when user confirmed. Before the point is drawed, the user must click OK on a dialog, then an other dialog created, the user must give some information such as Username,ID and User's mobile phone No, etc. in a dialog. Nothing is wrong in the compling phase, But when I run the project, JBuilder reported me a java.lang.OutOfMemoryError. I was confused. Here is the debug message:

-----------------------
D:\JBuilderX\jdk1.4\bin\javaw -classpath
"C:\Projects\Electric_Control\new\Electric_Control\classes;D:\JBuilderX\jdk1.4\lib\comm.jar;
D:\JBuilderX\jdk1.4\demo\jfc\Java2D\Java2Demo.jar;
D:\JBuilderX\jdk1.4\demo\plugin\jfc\Java2D\Java2Demo.jar;
D:\JBuilderX\jdk1.4\jre\javaws\javaws.jar;
D:\JBuilderX\jdk1.4\jre\lib\charsets.jar;
D:\JBuilderX\jdk1.4\jre\lib\ext\dnsns.jar;
D:\JBuilderX\jdk1.4\jre\lib\ext\ldapsec.jar;
D:\JBuilderX\jdk1.4\jre\lib\ext\localedata.jar;
D:\JBuilderX\jdk1.4\jre\lib\ext\sunjce_provider.jar;
D:\JBuilderX\jdk1.4\jre\lib\im\in dicim.jar;
D:\JBuilderX\jdk1.4\jre\lib\im\thaiim.jar;
D:\JBuilderX\jdk1.4\jre\lib\jce.jar;
D:\JBuilderX\jdk1.4\jre\lib\jsse.jar;
D:\JBuilderX\jdk1.4\jre\lib\plugin.jar;
D:\JBuilderX\jdk1.4\jre\lib\rt.jar;
D:\JBuilderX\jdk1.4\jre\lib\sunrsasign.jar;
D:\JBuilderX\jdk1.4\lib\dt.jar;
D:\JBuilderX\jdk1.4\lib\htmlconverter.jar;
D:\JBuilderX\jdk1.4\lib\tools.jar" gui.ElecCtrl
java.lang.OutOfMemoryError
-----------------------

Below will be my code:

MainGui:



The popup dialog code which the user click OK :


The other dialog that the user give some information:



The code is quite long Thank you for reading!

[ Jess edited the classpath so that it doesn't stretch the screen all the way across, also removed the "quote" block around the classpath because UBB has issues when you edit a post with "quote" and "code" blocks in the same post ]
[ August 02, 2004: Message edited by: Jessica Sant ]
+Pie Number of slices to send: Send
I haven't read through your post, but a quick fix may be to simply increase the size of the heap and avoid the OutOfMemoryError.

when you start the program, add something like this:
java -Xmx400m com.package.MyClass

That command allocates 400MB to the Java Heap -- and hopefully allows your program to run.

If something like that doesn't work, you'll need to debug your program and find out where the memory leak is. JProbe is a great program that you can use to easily identify those pesky memory leaks.
The government thinks you are too stupid to make your own lightbulb choices. But this tiny ad thinks you are smart:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1573 times.
Similar Threads
JLabel
Text Area help...Please!!!
jTable, Table Models, Data : Can anyone explain how to use them?
JCheckBox?
A question of accessing mysql in java
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 04:16:30.