Posted By


AndreasKT on 05/04/10

Tagged


Statistics


Viewed 675 times
Favorited by 0 user(s)

getResourceFile


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



Copy this code and paste it in your HTML
  1. public static File getResourceFile(String filePathAndName) {
  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 += filePathAndName;
  8. File resourceFile = new File(path);
  9. return resourceFile;
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.