Here you can find the source of existsInClasspath(Class clazz, String fileName)
@SuppressWarnings("rawtypes") public static boolean existsInClasspath(Class clazz, String fileName)
//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; } }