开发者

Can a java .classpath refer to a .jar file within the eclipse plugin folder independant of install location?

I have an Eclipse plugin which stores its class library at \plugins\edu.wpi.first.javade开发者_如何学编程v.sunspotfrcsdk_1.0.6.5\sunspotfrcsdk\lib\WPILibJ\classes.jar within the Eclipse install directory. At present, the .classpath uses an absolute path, so breaks when the project is run on another computer.

How can I make the .classpath refer to a .jar file using a path relative to the eclipse install directory?


Plugins should generally be referenced in eclipse .classpath as Libraries not Jars.

if you look at the .classpath file you'll see this distinction:

<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="src" path="webdriver-tests"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.testng.TESTNG_CONTAINER"/>
<classpathentry kind="lib" path="lib-new/test/hamcrest-all.jar"/>

The kind src is a source folder the kind con is a Library, and kind lib is regular jar.

You'll notice the kind="con" points to a static container for the library and is not dependent on a path. Plugins should provide this container and you can add them to your build path through project context menu

Build Path->Configure Build Path...->Add Library

Here's a screenshot:

Can a java .classpath refer to a .jar file within the eclipse plugin folder independant of install location?

Note that all developers will need the plugin installed for this to work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜