How Eclipse Finds Your Classes at Runtime

In Eclipse each plug-in has its own class loader and has its own class look-up path that is derived from the imported plug-ins. A separate class loader gives each plug-in a separate name space for its classes. The class loader also is responsible for triggering the activation of a plug-in. When a plug-in class loader loads the first class from a plug-in, then the plug-in is activated and the plug-in's startup() method is called.

The classes are looked-up in the following order:

  1. The plug-in class loader's parents— The immediate parent of a plug-in class loader is the Eclipse boot class loader. It provides access to the Eclipse boot classes (boot.jar). The parent of the boot class loader is the standard Java system class loader, which terminates the parent chain. Notice that the application class loader, which loads classes from the system's CLASSPATH variable is not part of this chain. This means classes on the system class path are never found by Eclipse. Plug-ins are the only way to surface additional classes. The following spider diagram illustrates the parent chain:

    graphics/06inf04.gif

  2. The plug-in's class loader itself— It finds the classes contributed by the plug-in as specified in the run-time section of the plugin.xml manifest.

    graphics/06inf05.gif

  3. The plug-in class loaders of the imported/prerequisite plug-ins— A delegating URL class loader is used internally to forward the class lookup to the imported plug-ins.

    graphics/06inf06.gif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值