快速掌握批量合并视频

嚯霍嚯

关注

阅读 38

2023-10-09

public class Test {
    public static void main(String[] args) throws Exception {
        ClassLoader compile = CompilerUtil.getCompiler(null)
                .addSource("Hello", "public class Hello{public static void main(String[] args){System.out.println(\"Hello World!\");}}")
                .compile();
        Class<?> hello = compile.loadClass("Hello");
        // 实例化对象c
//        Object obj = ReflectUtil.newInstance(hello);
        hello.getMethod("main", String[].class).invoke(null, (Object) new String[]{});
    }
}

https://doc.hutool.cn/pages/CompilerUtil/

精彩评论(0)

0 0 举报