Results 1 to 6 of 6
- 08-12-2010, 12:53 PM #1
Member
- Join Date
- Apr 2009
- Posts
- 8
- Rep Power
- 0
how to solve this ERROR --java.lang.OutOfMemoryError: Java heap space
I am Trying to read one TEXT file line by line. file size is approx. 7 MB or it contain approx. 35000 line of text.
i am processing that file and export data into another file.
mean while after some line i get error like below,
java.lang.OutOfMemoryError: Java heap space
After this error process stop.
my application is in Java Swing and i m using java 1.5 version of SDK and JRE.
is it a JDK version Problem?
please can any one give me appropriate solutions for this.
give me answer please.............
-
Rather than read in the whole file, how about streaming in the file and streaming out the processed information. Note that this has nothing to do with Swing and as such I am moving it out of the Swing forum.
Edit: I see that you've cross-posted this in the Sun forum without informing us, which is not appreciated. The problem is that you're asking unpaid volunteers to help you here, not paid consultants, and most of us mind if we take time away from work/lives/play to try to help someone only to find that we've provided a solution that was already provided in a cross-post hours ago. The proper thing to do is that if you feel you must cross-post, at least provide links in each cross-post to the other, so that folks don't waste time answering something already answered and so that folks can review all discussions that have already occurred.Last edited by Fubarable; 08-12-2010 at 01:03 PM.
- 08-12-2010, 03:57 PM #3
Member
- Join Date
- Apr 2009
- Posts
- 8
- Rep Power
- 0
apologies
sorry for this cross posting .
i don't know about this.
- 08-12-2010, 04:38 PM #4
Senior Member
- Join Date
- Jul 2010
- Posts
- 124
- Rep Power
- 0
Well, you could get the text from the text file, then create a conditional:
What this code says:Java Code:String s = getTextInfo(); if (s.length > 400){ s = s.substring(0,400); } else { displayData(); }
If the length of the string is greater then 400, it will trim it, but not delete it from the file. Cheers,
~Crikey
- 08-12-2010, 04:55 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,384
- Blog Entries
- 7
- Rep Power
- 17
- 08-13-2010, 10:04 AM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Similar Threads
-
java.lang.OutOfMemoryError: Java heap space
By paul in forum Advanced JavaReplies: 11Last Post: 06-12-2010, 05:30 PM -
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
By vasavi.singh in forum Advanced JavaReplies: 10Last Post: 05-11-2009, 11:56 AM -
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
By Ms.Ranjan in forum New To JavaReplies: 3Last Post: 04-22-2009, 08:25 PM -
java.lang.OutOfMemoryError: Java heap space
By vidjogamer in forum New To JavaReplies: 3Last Post: 02-06-2009, 06:52 AM -
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
By Eku in forum NetBeansReplies: 14Last Post: 06-12-2008, 08:36 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks