public static String locateFile(String name){
  File file=new File(name);
  if (file.exists()) {
    return name;
  }
 else {
    java.net.URL url=ClassLoader.getSystemResource(name);
    if (url != null) {
      String newname=url.getFile();
      file=new File(newname);
      if (file.exists()) {
        return newname;
      }
    }
  }
  return null;
}

public static String locateFile ( String name ) { File file = new File ( name ) ; if ( file . exists ( ) ) { return name ; } else { java . net . URL url = ClassLoader . getSystemResource ( name ) ; if ( url != null ) { String newname = url . getFile ( ) ; file = new File ( newname ) ; if ( file . exists ( ) ) { return newname ; } } } return null ; }
locate file ' filename ' in classpath , if it is not an absolute file name .
