I changed the it so an absolute path is taken e.g.
File f = new File("C:\\data\\" + fileName);
This works. Does having it in a servlet change it so an absolute path is needed and render relative paths unusable? I tested the downloading part outside of a servlet and it works with relative paths or it just downloads into project folder if nothing is specified.