Java ClassLoader Load getFileFromPath(Object obj, String fileName)

Here you can find the source of getFileFromPath(Object obj, String fileName)

Description

get File From Path

License

Apache License

Declaration

private static File getFileFromPath(Object obj, String fileName) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.net.URL;

public class Main {
    private static File getFileFromPath(Object obj, String fileName) {
        ClassLoader classLoader = obj.getClass().getClassLoader();
        URL resource = classLoader.getResource(fileName);
        return new File(resource.getPath());
    }//from   w ww  . ja  va  2  s .  c  o m
}

Related

  1. getFile(final String filename)
  2. getFile(final String name)
  3. getFile(Object obj, String filename)
  4. getFileContents(String filename)
  5. getFileContents(String path)
  6. getFileFromPool(String path)
  7. getFileFullPath(String file)
  8. getFilesInPackage(String packageName)
  9. getFullPathByPkg(String pkg)