I want to read an XML file that is located inside one of the jars included in my class path. How can I read any file which is included in the jar?
I want to read an XML file that is located inside one of the jars included in my class path. How can I read any file which is included in the jar?
This also works on spring
ClassPathResource resource = new ClassPathResource("/file.txt", MainApplication.class); //resources folder
InputStream inputStream = resource.getInputStream();
File file = new File("file.txt");
FileUtils.copyInputStreamToFile(inputStream, file);