I'm trying to find an image in my JSF project. Here's my folder structure:
The image is inside the "imagesFedex" folder.
I'm trying to find its path like this:
String ctx = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
try {
FileInputStream imagem = new FileInputStream(ctx + "/src/main/webapp/imagesFedex/nova_logorapidao2.png");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
But it's throwing the filenotfound exception. I've read that the images goes inside the resources folder. Do I have to change its location? How can I get this path correctly?