I am trying to read some numerical values from a file and getting this error:
Input Error: Error in input: Floating point number not found.; Expecting Real number in the range -1.7976931348623157E308 to 1.7976931348623157E308

[code=java]
import java.io.*;
public class TriangleMain {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        TextReader data;
        
        //String name;
        double x1,y1,x2,y2,x3,y3;

      try 
      {  // Create the input stream.
         data = new TextReader(new FileReader("points.txt"));
      }
      catch (FileNotFoundException e) {
         System.out.println("Can't find file points.txt!");
         return;  // End the program by returning from main().
      }
      try {
      
          // Read numbers from the input file and print them out
          
          while ( data.eof() == false ) {  // Read until end-of-file.
             //name=data.getWord();
             x1 = data.getDouble();
             y1 = data.getDouble();
             x2 = data.getDouble();
             y2 = data.getlnDouble();
             x3 = data.getlnDouble();
             y3 = data.getlnDouble();
             System.out.println("The end points are ("+x1+", "+y1+") and ("+x2+", "+y2+")");//) and ("+x3+", "+ y3+")");
          }
       
       }
       catch (IOException e) {
             // Some problem reading the data from the input file.
          System.out.println("Input Error: " + e.getMessage());
       }

        
    }

}

txt file is attached with this thread.

You have words like "Bob" in your text file. If the program is looking for a floating point number and runs across "Bob", you are going to get an error.

so any suggestions do I have to get all values as string and then change them as float or double???

oh well Thanks I got it actually I was calling wrong get method to read last point I needed to call
data.getlnDouble();
thanks

Well, you commented out the line that would have read the name data, so you're going to need to put that back in or skip ahead in your input stream somehow. Since you're using some third-party TextReader class, we can't really offer much advice on using that specifically.

Edit: I guess you figured it out, but the code you have posted doesn't really match with that text file you attached.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.