File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 42965
Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
I agree. Here's the link:
subject: exception while Read very large file > 300 MB
It's not a secret anymore!