io/resource is looking for the file in the class path, not the current directory. It may even be looking for something/file.txt in the class path, since it's a relative path in the something namespace.