Netbeans doesn't seems to call the *.class
generated in the root package folder. Netbeans use a working directory which could be something like bin/
or something like that.
You should either check the execution parameters or pass the filename as a parameter (configure Netbeans to send src/yourpackage/file.dat
as the first argument en use arguments[0] to get it for example)