Егор Лебедев Егор Лебедев - 1 year ago 150
Java Question

Java: file not found exception

File file1 = new File("news1.txt");

This prints false, but file
is in directory, with that class.

Answer Source

This assumes that news1.txt is in the same folder as the class, calling this code. If you are using Eclipse, for example, this will look for the file in the root folder of the project, and not in the src folder. You should verify that the file is indeed in the right location.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download