public static void copyResourceFromClass(Class clazz,String file,File toFile) throws IOException {
  try (InputStream ins=clazz.getResourceAsStream(clazz.getSimpleName() + "/" + file)){
    if (ins == null) {
      throw new IllegalStateException("Resource file " + file + " not found");
    }
    FileUtils.copyInputStreamToFile(ins,toFile);
  }
 }

public static void copyResourceFromClass ( Class clazz , String file , File toFile ) throws IOException { try ( InputStream ins = clazz . getResourceAsStream ( clazz . getSimpleName ( ) + "/" + file ) ) { if ( ins == null ) { throw new IllegalStateException ( "Resource file " + file + " not found" ) ; } FileUtils . copyInputStreamToFile ( ins , toFile ) ; } }
unused and replaced with resources dir .
