Reading Files From JAR - Maven Project
ClassLoader loader = getClass().getClassLoader(); in = loader.getResourceAsStream("templates/"+templateType.getValue()+".xml"); where the template is stored in a maven project as in Src--> main--> resources-->templates-->template.xml