在Eclipse中常常需要动态载入某些我们自定义的类,这个时候如果使用Class.forName函数是不能实现我们的目标的,如果我们仅仅使用这一函数会报ClassNotFound错。解决这一问题的方法是:

try {

  Bundle bundle = Platform.getBundle("PlugIn的ID");
  Class clazz = bundle.loadClass("自定义类名");
} catch (Exception e) {
  e.printStackTrace();
}

够简单吧。

相关文章:

  • 2021-11-27
  • 2022-03-07
  • 2021-10-14
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2021-08-18
  • 2021-05-24
猜你喜欢
  • 2021-11-05
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2021-05-11
  • 2021-10-02
  • 2021-09-11
相关资源
相似解决方案