您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何在运行时动态地将外部jar文件添加到ClassPath?

如何在运行时动态地将外部jar文件添加到ClassPath?

urlclassloader child = new urlclassloader (myJar.toURL(), this.getClass().getClassLoader()); Class classToLoad = Class.forName (“com.MyClass”, true, child); Method method = classToLoad.getDeclaredMethod (“myMethod”); Object instance = classToLoad.newInstance (); Object result = method.invoke (instance);

其他 2022/1/1 18:28:43 有371人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶