Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3981160
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:22:38+00:00 2026-05-20T05:22:38+00:00

I tried to read a text file which have only one line. File size

  • 0

I tried to read a text file which have only one line. File size is over 50Mb. When I tried to read it using the following code it gives

java.lang.outofmemory exception jvm
heap size insufficient

I change the java heap memory to 1GB . But still it gives the same exception.

set JAVA_OPTS=-Xms1024m -Xmx1024m

I use foollowing code pragment to read the file.

BufferedReader Filein1=new
BufferedReader(new FileReader( new
File( “C:\ABC\MsgStream.txt” )));
s=Filein1.readLine();

Can some one please tell me how to overcome this problem. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:22:38+00:00Added an answer on May 20, 2026 at 5:22 am

    The JAVA_OPTS environment variable is only respected by certain applications (for example the wrapper scripts that are typically used to launch Tomcat). The java command doesn’t pay any attention to it.

    You need to put the options on the java command line … before the classname; e.g.

    java -Xms1024m -Xmx1024m ... some.pkg.MainClass ...
    

    (A 1Gb heap should be more than adequate for buffering a 50Mb file.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've encountered a problem. I have a code which should read the following text
I have a text file which has first line as below: j0W82LBrSdUbw Basically it
I have a text file which was created using some Microsoft reporting tool. The
I have to read a text file which can begin with optional comments. In
I have read the following properties from AD, TerminalServicesProfilePath TerminalServicesHomeDirectory TerminalServicesHomeDrive I've tried DirectoryEntry
I have a text file which contains data I need to preload into a
I have a word file () which has many text fields and a startup
Problem I have a file which contains such text (nothing else) 2010-10-05 I would
I have a text file (c:\input.txt) which has: 2.0 4.0 8.0 16.0 32.0 64.0
I have a file which has text like this: #1#14#ADEADE#CAH0F#0#0..... I need to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.