Java Resource Load getResourceFile(String relativeResourceFilePathname)

Here you can find the source of getResourceFile(String relativeResourceFilePathname)

Description

get Resource File

License

Open Source License

Parameter

Parameter Description
relativeResourceFilePathname a relative path of a resource without a leading '/': resources/relativeResourceFilePathname.

Return

the resource file.

Declaration

public static File getResourceFile(String relativeResourceFilePathname) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;
import static com.google.common.io.Resources.*;

public class Main {
    /**//from  w w  w .  ja  v  a  2  s.c o  m
     * @param relativeResourceFilePathname a relative path of a resource without a leading '/': resources/relativeResourceFilePathname.
     * @return the resource file.
     */
    public static File getResourceFile(String relativeResourceFilePathname) throws Exception {
        return new File(getResource(relativeResourceFilePathname).toURI());
    }
}

Related

  1. getResourceBytes(String path)
  2. getResourceByZip(final ZipInputStream zipIN, final String resourcePath)
  3. getResourceDirectory()
  4. getResourceFile(Class clazz, String path)
  5. getResourceFile(Class theClass, String fileName)
  6. getResourceFile(String resource)
  7. getResourceFile(String resourceName)
  8. getResourceFromJar(File fromFile, String insideFile)
  9. getResourceInDirPackage(String packageName, String packagePath, final boolean recursive, List classes)