Load a file from src folder into a reader
问题 I would like to know how can I load a file lol.txt from src folder into my close method. The code so far: public void close() throws IOException { boolean loadFromClasspath = true; String fileName = "..."; // provide an absolute path here to be sure that file is found BufferedReader reader = null; try { if (loadFromClasspath) { // loading from classpath // see the link above for more options InputStream in = getClass().getClassLoader().getResourceAsStream("lol.txt"); reader = new