As Obicere said, the working directory is the project directory. You try to access something in the src
folder, which probably doesn't exist wherever you exported your JAR. You should create a folder named folder_lock
in your project directory with accounts.accs
in it, then get your file with:
File file = new File("folder_lock" + File.separator + "accounts.accs");
If you need it in your JAR (which it's being exported to, given that it's in the src
folder) then retrieve an InputStream
from it like this:
InputStream stream = getClass().getClassLoader().getResourceAsStream("puffinlump/folder_lock/accounts.accs");
If your method is static, use
InputStream stream = MyClass.class.getClassLoader().getResourceAsStream("puffinlump/folder_lock/accounts.accs");
instead, substituting your class name over MyClass
.
If you need an URL, you can retrieve one with getResource
instead of getResourceAsStream
.
Note that your code must be compiled to run - Eclipse compiles it by default every time you save.