Posted By

AndreasKT on 05/04/10


Tagged

file path open


Versions (?)

getResourceFile


 / Published in: Java
 

  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  

You need to login to post a comment.