Cannot find file on netbeans
I'm trying to access a data file to get questions and answers for my
"Quiz" application. If I access the file from the one on my desktop, it
works fine. If I drag and drop the file into my netbeans, I cannot seem to
access it. The file is in the package "quiz" along with my other classes.
Here's the code that works but I want to use the netbeans file.
String fileName = "C:/Users/Michael/Desktop/QUIZ.DAT";
try {
//Make fileReader object to read the file
FileReader file = new FileReader(new File(fileName));
BufferedReader fileStream = new BufferedReader(file);
} catch (Exception e) {
System.out.println("File not found");
}
To try and access the file on netbeans I use this but it cannot find it.
String fileName = "quiz/Quiz.DAT";
No comments:
Post a Comment