Posted By

AndreasKT on 05/04/10


Tagged

path open Resource


Versions (?)

getResourcePath


 / Published in: Java
 

  1. public static String getResourcePath() {
  2. String className = ConfigUser.class.getName();
  3. String classNamePath = className.replace(".", "/") + ".class";
  4. URL is = ConfigUser.class.getClassLoader().getResource(classNamePath);
  5. String path = is.getFile();
  6. path = StringUtils.substringBefore(path, "classes");
  7. path = StringUtils.replace(path, "%20", " ");
  8.  
  9. return StringUtils.removeStart(path, "/");
  10. }

Report this snippet  

You need to login to post a comment.