How do I “install” a log4j bundle?

时光毁灭记忆、已成空白 提交于 2019-12-01 09:16:43

问题


I've downloaded the code for an Eclipse plugin. The code uses log4j, but it doesn't just use it as a library (referred jar), but as a "bundle". So it doesn't compile because of the following reason:

Bundle 'org.apache.log4j' cannot be resolved

I'm not really sure what's the correct approach to solve this. I know how to add jars to a project, but how do I add "bundles"? Is it something I need to add to the entire Eclipse host?

I "solved" this by creating a new plugin project with no code but with the log4j jar included... but that doesn't feel like the right solution.

I've also found some places where "log4j bundles" are published, e.g.:

  • http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.log4j&version=1.2.16
  • http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/

But I'm not sure if that's what I need, if it matters where I get it from, and how to "install" it.


回答1:


I assume you are using the Eclipse Plugin Development Environment (PDE). In this case, the log4j bundle needs to be imported into the "Target Platform".

The Target Platform is like a repository of bundles (i.e. plug-ins) that replaces the "classpath" in traditional Java development. You can find the location of the target platform and modify it by going to Preferences -> Plug-in Development -> Target Platform.

HOWEVER before doing this I strongly recommend you take some time to learn a bit about what you are working on! If you want to develop an Eclipse Plug-in you should at least learn what a plug-in is, and how its dependencies work. If you read a bit about the subject you should not have to ask such an extremely basic question on Stack Overflow... it is covered in all the introductory tutorials and FAQs.



来源:https://stackoverflow.com/questions/8285745/how-do-i-install-a-log4j-bundle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!