0
点赞
收藏
分享

微信扫一扫

快速掌握批量合并视频

嚯霍嚯 2023-10-09 阅读 38
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 条评论