I’m trying to use getResourceAsStream to load a java keystore albeit unsuccessfully. I’m not sure why it fails, but I’m loading it inside Play! 2.0 from a subfolder inside a typical folder.
Here’s the folder structure and keystore location:
play root >> app >> subfolder1 >> keystore
And the location of the file I’m loading it from:
play root >> app >> subfolder1 >> scala.class
And how I am loading it inside scala.class:
getClass().getResourceAsStream("/keystore")
Any ideas as to what’s going wrong?
By prefacing the path with
/you’re asking for akeystoreat the root of the package hierarchy. Try either of the following:See the Java documentation for more detail on how to specify resource paths.