Here you can find the source of getResourceFile(Class> clazz, String path)
Parameter | Description |
---|---|
path | ex : "/config/cnig_PLU_2014/files.xml" |
public static File getResourceFile(Class<?> clazz, String path)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { /**/*w ww. j a v a2s .c o m*/ * Get resource File corresponding to a given path in clazz package * * @param path ex : "/config/cnig_PLU_2014/files.xml" * @return */ public static File getResourceFile(Class<?> clazz, String path) { try { return new File(clazz.getResource(path).getPath()); } catch (NullPointerException e) { throw new RuntimeException("Resource '" + path + "' not found"); } } }