Posted By


AndreasKT on 05/04/10

Tagged


Statistics


Viewed 300 times
Favorited by 0 user(s)

getResourcePath


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.