It's not a secret anymore!
The moose likes Performance and the fly likes exception while Read very large file > 300 MB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Performance
Reply locked New topic

exception while Read very large file > 300 MB

Ganesh Sugumaran

Joined: Jul 08, 2008
Posts: 10
I want to read a file which has size of more than 300 MB.
While i m executing my code, i m getting
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Below is my code

Im getting the exception in the line 2.
Even though i increased the Heap space up to 900 Mb, i m getting this error.
I executed in command prompt like below,
java -Xms128m -Xmx1024m readLargeFile

Kindly give a solution for this. is there any other best way to read large text file ??
I m waiting for your reply..
Thanks in advance
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
It is sorta covered in the JavaRanch Style Guide.
subject: exception while Read very large file > 300 MB
jQuery in Action, 3rd edition