Java ClassPath Get getClasspathFile(String fn)

Here you can find the source of getClasspathFile(String fn)

Description

get Classpath File

License

Open Source License

Declaration

public static File getClasspathFile(String fn) 

Method Source Code


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

import java.io.File;

import java.net.URISyntaxException;

public class Main {
    public static File getClasspathFile(String fn) {
        File f = null;//from ww  w . j av a  2  s.  com
        try {
            f = new File(Thread.currentThread().getContextClassLoader().getResource(fn).toURI());
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
        return f;
    }
}

Related

  1. getClasspathDir(Class klass)
  2. getClasspathFile(Class clz)
  3. getClassPathFile(Class clazz)
  4. getClasspathFile(final String name)
  5. getClassPathFile(final String path, final ClassLoader classLoader)
  6. getClassPathFile(String pathName)
  7. getClasspathFilePathFromName(String fileName)
  8. getClassPathFor(final Class clazz)
  9. getClasspathForClass(Class targetClass)