Try this for asking for your class
String s = getClass().getName(); int i = s.lastIndexOf("."); if(i > -1) s = s.substring(i + 1); s = s + ".class"; System.out.println("name " +s); Object testPath = this.getClass().getResource(s); System.out.println(testPath); this code snippet is from this.getClass().getResource("").getPath() returns an incorrect paththis.getClass().getResource("").getPath() returns an incorrect path