Java Resource Path Get getResourceAsFile(String relativePath)

Here you can find the source of getResourceAsFile(String relativePath)

Description

get Resource As File

License

Open Source License

Declaration

public static File getResourceAsFile(String relativePath)
            throws URISyntaxException 

Method Source Code

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

import java.io.File;

import java.net.URISyntaxException;
import java.net.URL;

public class Main {
    public static File getResourceAsFile(String relativePath)
            throws URISyntaxException {
        URL url = Thread.currentThread().getContextClassLoader()
                .getResource(relativePath);
        File file = new File(url.toURI());
        return file;
    }/*from  www . j a  v a 2 s.c o m*/
}

Related

  1. getResource(String path)
  2. getResource(String path)
  3. getResource(String relativePath)
  4. getResource(String resourcePath)
  5. getResourceAsFile(Object relativeTo, String relativePath)
  6. getResourceAsStream(final String path)
  7. getResourceAsStream(String resourcePath, ClassLoader classLoader, Class clazz)
  8. getResourceAsString(String path)
  9. getResourceFile(Class clazz, String relPath)