In this tutorial, we will show you how to read a file from a resources folder, in both Java and Unit Test environment. In simple, put files in a resources folder, and read the file with following code snippets :

	ClassLoader classLoader = getClass().getClassLoader();
	File file = new File(classLoader.getResource("file/test.xml").getFile());

1. Project Directory

Review a Maven project Structure.