I cannot get to make the following code work:
public static void main(String[] args) {
try {
InputStream f = new FileInputStream("test.txt");
} catch (Throwable t) {
t.printStackTrace(System.err) ;
}
}
This throws the exception that says that the file test.txt could not be found. I've tried putting it in pretty much every directory possible in the project, I've checked what the root directory was with:
System.out.println(new File(".").getAbsolutePath());
And no matter where I put the file, it will never find it. Even tried putting it in C:\test.txt and this does not work either
The returned exception is the following:
java.io.FileNotFoundException: test.txt (Le fichier spécifié est introuvable // means File not found)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at main.Main.main(Main.java:30)