I'm trying to read a text file line by line within my HTML/Javascript web page.
The text file I want to read is in the "data" folder in the web page directory. To read the text file, I'm using FileReader and BufferedReader within my script tags.
I'm getting an error "Uncaught syntax error: Unexpected identifier" on the line where I create the FileReader with the file path, see code below.
I thought the problem might be that these were Java objects so perhaps I needed to import those. I tried to add:
import java.io.FileReader;
and
import java.io.BufferedReader;
but then got an
"Unexpected identifier"
error for
"import java.io.FileReader;
"
FileReader tidewatchDataOutput = new FileReader("data/test.txt");
BufferedReader bufferSCHISMDataReader = new BufferedReader(tidewatchDataOutput);
The web page is no longer loading properly in Chrome as it did before; it just stops in the middle.