Results 1 to 2 of 2
  1. #1
    mary is offline Member
    Join Date
    Jul 2007
    Posts
    51
    Rep Power
    0

    Default There's not enough memory to process the command. at java.io.FileInputStream

    an exception appears when I enter too many words in other case works fine


    Java Code:
    BufferedReader brd = new BufferedReader(new InputStreamReader(System.in));
    while (true){
    String stsr = brd .readLine();

    Java Code:
    "Exception in thread "main" java.io.IOException: 
    There's not enough memory to process the command. 
    at java.io.FileInputStream.available(Native Method)
    at java.io.BufferedInputStream.read
    (BufferedInputStream.java:279)
    at sun.nio.cs.StreamDecoder$CharsetSD.readBytes
    (StreamDecoder.java:406)
    at sun.nio.cs.StreamDecoder$CharsetSD.implRead
    (StreamDecoder.java:446)
    at sun.nio.cs.StreamDecoder.read
    (StreamDecoder.java:180)
    at java.io.InputStreamReader.read
    (InputStreamReader.java:167)
    at java.io.BufferedReader.fill
    (BufferedReader.java:136)
    at java.io.BufferedReader.readLine
    (BufferedReader.java:299)
    at java.io.BufferedReader.readLine
    (BufferedReader.java:362)
    at testClient.main(testClient.java:43)
    help please

  2. #2
    Heather is offline Senior Member
    Join Date
    Jun 2007
    Posts
    164
    Rep Power
    8

    Default

    maybe a better solution is to not use BufferedReader.readLine at all, and instead write your own "read line" code so you can have better control over how large amounts of data are accepted by your application.

Similar Threads

  1. Replies: 5
    Last Post: 02-02-2010, 10:06 AM
  2. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 01:23 AM
  3. Java Heap Out of Memory Error
    By stonkers in forum New To Java
    Replies: 3
    Last Post: 07-17-2007, 05:43 PM
  4. Linux process from java
    By Ed in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 06:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •