Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

How to open a file?

Stavros Kefaleas
9 years ago Dec 24, 2013 9:02pm
Michael Tzukanov
9 years ago Dec 27, 2013 8:19am
Stavros Kefaleas
9 years ago Dec 27, 2013 10:21am
Teppo Kurki
9 years ago Dec 28, 2013 12:53pm

The getRealPath method will only return the real path if the translation is possible and allowed. So please check the configuration of the server you're running on for allowing the translation - and of course that the file is actually available.

If you just need the file as a stream, you could work around by calling ServletContext.getResourceAsStream method.

Stavros Kefaleas
9 years ago Dec 30, 2013 12:19pm