Return to Snippet

Revision: 26608
at May 4, 2010 04:17 by AndreasKT


Initial Code
	public static File getResourceFile(String filePathAndName) {
		String className = ConfigUser.class.getName();
		String classNamePath = className.replace(".", "/") + ".class";
		URL is = ConfigUser.class.getClassLoader().getResource(classNamePath);
		String path = is.getFile();
		path = StringUtils.substringBefore(path, "classes");
		path += filePathAndName;
		File resourceFile = new File(path);
		return resourceFile;
	}

Initial URL


Initial Description


Initial Title
getResourceFile

Initial Tags
file, path

Initial Language
Java