Getting Resources from a jar: classloader vs class resourceasstream
问题 I am trying to implement a method that when called, get a string from a particular resource in the jar that the class is loaded from. For example: import mypath.myclass; //from a jar String result = gitid.getGitId(myclass.class); On the backed I am currently using: InputStream is = null; BufferedReader br = null; String line; is = c.getResourceAsStream("/com/file.text"); The problem is I keep getting the same resource for no matter what class I give it. I have also tried: is = c