Java is really nitpicky about relative paths, so `"myfile.txt" should probably live wherever your project is being built.
As for closing the dataInputStream
, it is not in scope. Declare it outside of your try block. In any case, I'd suggest placing the actual close()
call in a finally block to make sure it is always done (if the reference isn't null).