This way you can read a file from your harddrive in Java. But how to read a file from classpath? Which means from current JAR or WAR or any other JAR this application uses. You must open your file using:
= new InputStreamReader(Main.class.getClass()
If your file is inside some package, use slash do delimit packages. This method returns InputStream. If you want to open a text file, convert it to reader using InputStreamReader.