When you say "same directory as JSP", what exactly do you mean by that? That your JSP sits somewhere in, say, /mywebapp/somefolder/my.jsp
with mywebapp
being your application root and your properties file is /mywebapp/somefolder/channelLogos.properties
?
If so, then most likely they're NOT in the same directory. JSP has been compiled and where it is actually located may vary depending on servlet container. Your best bet is to use ServletContext.getRealPath()
as suggested by pkaeding with properties file path relative to webapp context as an argument. Using the above example:
private Properties logoUrls = new Properties();
logoUrls.load(new FileInputStream(servletContext.getRealPath("/somefolder/channelLogos.properties")));
That said, keep in mind that if you insist on putting your properties in the same folder as JSP you should take care to restrict it from being publicly accessible (unless that's the intention).