怎么读取动态创建的java文件里的类

public  void writefile() throws Exception {
        String h="D:\\ff\\src\\main\\java\\com\\example\\ee";
        String fn="D:\\ff\\src\\main\\java\\com\\example\\ee\\A1.java";
        File ff=new File(fn);
        if(!ff.exists()){ff.createNewFile();}
        FileWriter fw = new FileWriter(ff);
        String str="package com.example.ee;\n" +
                "public class A1 {\n" +
                "public static void main(String[] args) {System.out.println(11);}" +
                "public void f(){System.out.println(\"fff\");}}";
        fw.write(str);
        fw.close();
        Thread.sleep(1111);
    }

    @Test
    public  void eee() throws Exception {
        String h="D:\\ff\\src\\main\\java\\com\\example\\ee";
        String fn="D:\\ff\\src\\main\\java\\com\\example\\ee\\A1.java";
        writefile();
        //JavaCompiler systemJavaCompiler = ToolProvider.getSystemJavaCompiler();
        //int run = systemJavaCompiler.run(null, null, null, fn);
        URL[] urls=new URL[]{new URL("file:/"+h)};
        URLClassLoader cl=new URLClassLoader(urls);
        Class<?> aClass = cl.loadClass("com.example.ee.A1");
        Method f = aClass.getMethod("f");
        f.invoke(aClass.newInstance());
        Method m = aClass.getMethod("main",String[].class);
        m.invoke(null,(Object)new String[]{});
    }

动态写一个java文件com.example.ee.A1,然后报错
java.lang.ClassNotFoundException: com.example.ee.A1。
有什么方法读到它吗

你就直接说你要干嘛吧,这样我还好回答点,如果你要调用一个类的方法,可以直接将这个类声明成静态类,方位声明静态方法,然后类名.方法就可以了。
如果你想传值到类中,可以通过构造函数传,也就是new 类(xx,xx)这种形式。