Hi,
I am trying extract data into a file and then put it into a multidim array.
I when execute the code Im getting a complie error with a problem with my fileReader class. The error i get is :
This is my code
This is the line where the problem occurs:
I know that I have inputted the file name and location correctly. i have also imported all of the necessary classes. I am not sure what the problem is though!?
I am trying extract data into a file and then put it into a multidim array.
I when execute the code Im getting a complie error with a problem with my fileReader class. The error i get is :
Code:
Unhandled exception type FileNotFoundException
This is my code
Code:
/* TODO import data from .csv file */
String[][] serverData = new String[3][16];
final String FILE_NAME = "C:\\testFile.csv";
BufferedReader inputFromFile = null;
inputFromFile = new BufferedReader(new FileReader(FILE_NAME)); //This is where the problem occurs
String line = null;
int row = 0;
int col = 0;
//read each line of text file using StringTokenizer
while((line = inputFromFile.readLine()) != null)
{
StringTokenizer StringTok = new StringTokenizer(line,",");
while (StringTok.hasMoreTokens())
{
//store line in array
serverData[row][col] = StringTok.nextToken();
col++;
}
row++;
}
inputFromFile.close();
This is the line where the problem occurs:
Code:
inputFromFile = new BufferedReader(new FileReader(FILE_NAME)); //This is where the problem occurs
I know that I have inputted the file name and location correctly. i have also imported all of the necessary classes. I am not sure what the problem is though!?