Access local files in Vaadin

Hi All,

I am now trying to fill a Table with data from a text file in my local filesystem.


	public void init() {
		initLayout();
//		final FileResource stream = new FileResource(new File("input/hierarchy-query.txt"), ConceptApplication.getInstance());
		try {
			String contentString = FileUtils.readFileToString(new File("/input/hierarchy-query.txt"));
			System.out.println(contentString);
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println("contentString");

	}

See where I put the file in the directory.
directory

I kept getting errors like:

java.io.FileNotFoundException: input\hierarchy-query.txt (The system cannot find the path specified)

Where should I put this file? In general, how to access file in local filesystem using Vaadin?

What do you mean by ‘local’? if you mean the server your app is running on, then it should work like any other Java application. If you mean the local filesystem of the client browser, then that is not possible with anything else than signed applets.

Thanks for the reply.
I am running both server and client on the same pc. I figured, it is possible to access file on my pc by absolute path, but not by relative path. Maybe relative path also works, as is the case with any other Java application, but I do not where to put the file to be reached via relative path.

Best Regards.
Xichuan