Java ClassPath existsInClasspath(Class clazz, String fileName)

Here you can find the source of existsInClasspath(Class clazz, String fileName)

Description

exists In Classpath

License

Open Source License

Declaration

@SuppressWarnings("rawtypes")
    public static boolean existsInClasspath(Class clazz, String fileName) 

Method Source Code

//package com.java2s;
/**/* w  ww  .ja  va2 s .  c  o m*/
 * This software is released under the University of Illinois/Research and Academic Use License. See
 * the LICENSE file in the root folder for details. Copyright (c) 2016
 *
 * Developed by: The Cognitive Computations Group, University of Illinois at Urbana-Champaign
 * http://cogcomp.cs.illinois.edu/
 */

import java.net.URL;

public class Main {
    @SuppressWarnings("rawtypes")
    public static boolean existsInClasspath(Class clazz, String fileName) {
        URL dirURL = clazz.getResource("/" + fileName);
        return dirURL != null;
    }
}

Related

  1. calculateClassPath(ClassLoader cl)
  2. createClassLoader(List classpathElements, String... paths)
  3. createClassLoader(List libs, boolean useSystemClassPath)
  4. createClassPath(File file)
  5. dumpClasspath(ClassLoader loader)
  6. existsInClasspath(final String fileName)
  7. fillClassPath(ClassLoader cl, StringBuffer classpath)
  8. findClassPaths()
  9. findClassPaths()