Referencing files in an application

Hi, I’m having difficulty trying to reference a file “dynamically,” if that’s the right word for it. When I use a path like this:

new File("C:/some/path/file.xls");

it works fine, but the problem with that is that the file itself won’t be uploaded onto the Tomcat server I use when I want to deploy my application by WAR file. I need to find some way to reference the file by absolute path, as well as find a location I can put the file so that it is bundled in the WAR file and accessed by the app when it is hosted on the server.

I’ve placed the file (an excel file) in every folder I can think of, from the WebContent folder, WebContent/VAADIN, src folder, etc. None of them work when I try to reference it. When I had the file in the WebContent folder, I thought “/file.xls” would work but it didn’t.

If anyone can provide some insight I’d be very appreciative. Thanks!

This is not vaadin specific, so you will find plenty of approaches on the Web. For example, see:

I had a similar issue.
THE solution is …