It's not a secret anymore!*
The moose likes Java in General and the fly likes java.lang.OutOfMemoryError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java.lang.OutOfMemoryError" Watch "java.lang.OutOfMemoryError" New topic
Author

java.lang.OutOfMemoryError

George Ren
Ranch Hand

Joined: Aug 17, 2002
Posts: 58
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 ]

THINK!
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

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.


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java.lang.OutOfMemoryError
 
Similar Threads
JCheckBox?
A question of accessing mysql in java
JLabel
Text Area help...Please!!!
jTable, Table Models, Data : Can anyone explain how to use them?