I am trying to open a text file with the following code:
try{
FileReader fr=new FileReader("text\\test.txt");
BufferedReader br=new BufferedReader(fr);
int i;
while((i=br.read())!=-1){
System.out.print((char)i);
}
br.close();
fr.close();
} catch (IOException e){
e.printStackTrace();
}
This code results in this error (line 69 being the FileReader initialization):
W/System.err: java.io.FileNotFoundException: text\test.txt: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:492)
at java.io.FileInputStream.<init>(FileInputStream.java:160)
at java.io.FileInputStream.<init>(FileInputStream.java:115)
at java.io.FileReader.<init>(FileReader.java:58)
at com.example.mytrial.MainActivity.onCreate(MainActivity.java:69)
This is what my file system looks like: here
Any and All help is appreciated!