0

i am writing a plugin for eclipse 4.2 that will upload the jars the user adds to a project. in order to do this i need to want to retrieve the location of the jars in the class path. the problem is that as far as i can see IJavaProject doesn't make the distinction between a linked jar and a copied one. so when i use IClasspathEntry to retrieve the location of the jar the returned value is a location in the project and not the jars true location.

does any one know how can i retrieve it?

4

1 回答 1

0

我认为您正在寻求一种方法来查找项目内部 jar 的文件系统位置。

Eclipse 工作区使用本地文件系统的抽象,它与实际文件系统相似但不同。有一些 API 可以从文件系统位置转换IResource为文件系统位置。

通常,调用IClasspathEntry时将返回工作空间相关的位置getPath。因此,要获取类路径条目的文件系统位置,请执行以下操作:

ResourcesPlugin.getWorkspace.getRoot().getFile(entry.getPath()).getLocation();
于 2012-08-20T04:42:14.667 回答