Java ClassLoader findFile(String filename)

Here you can find the source of findFile(String filename)

Description

searches the classpath for a filename and returns a File object

License

Open Source License

Declaration

final public static File findFile(String filename) 

Method Source Code

//package com.java2s;
/* /*from   w  w w  . ja  v a  2s.c  om*/
 GeoGebra - Dynamic Mathematics for Everyone
 http://www.geogebra.org
    
 This file is part of GeoGebra.
    
 This program is free software; you can redistribute it and/or modify it 
 under the terms of the GNU General Public License as published by 
 the Free Software Foundation.
     
 */

import java.io.File;

import java.net.URL;

public class Main {
    /**
     * searches the classpath for a filename and returns a File object
     */
    final public static File findFile(String filename) {
        // search file
        URL url = ClassLoader.getSystemResource(filename);
        return new File(url.getFile());
    }
}

Related

  1. addFile(File file)
  2. addFile(String s)
  3. createDir(String pathName)
  4. createDirectoryLoader(String directory)
  5. CreateLogbackXML(OutputStream out)
  6. hasImageFile(String name)
  7. hasLogDatePatternMatcher(final String line)
  8. isExist(String path)
  9. isVMAlive(String procId)