Eclipse RCP的ClassLoad问题

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

try {

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

够简单吧。

posted on 2010-02-03 13:31  wayne.wang  阅读(343)  评论(0编辑  收藏  举报

导航