public static void copyResources(String src, File dst) throws IOException{
        InputStream is = PathUtils.class.getResourceAsStream(src);


        ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
        int ch;
        try {
            while ((ch = is.read()) != -1) {
                bytestream.write(ch);
            }
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        byte[] program = bytestream.toByteArray();

        java.io.FileOutputStream fo = new java.io.FileOutputStream(dst);
        fo.write(program);
        fo.close();

        try {
            bytestream.close();
        }
        catch (IOException e) {
            e.printStackTrace();
        }

        is.close();
    }
referer https://github.com/alibaba/arthas/blob/master/common/src/main/java/com/taobao/arthas/common/FileUtils.java
cop/src/main/java/code/landgrey/copagent/utils/PathUtils.java