How to really read text file from classpath in Java
With the directory on the classpath, from a class loaded by the same classloader, you should be able to use either of: // From ClassLoader, all paths are “absolute” already – there’s no context // from which they could be relative. Therefore you don’t need a leading slash. InputStream in = this.getClass().getClassLoader() .getResourceAsStream(“SomeTextFile.txt”); // From … Read more