I am developing currently on Windows and Linux in parallel. I am facing the problem when includin开发者_JAVA百科g libraries, the path cannot be found on both machines at the same time, as Eclipse saves the absolute path. Is there an option or something similiar?
If your libraries are inside the project, Eclipse references them relatively in the .classpath
file. For example:
<classpathentry kind="lib" path="lib/example.jar" />
The same applies if you are referencing libraries in your workspace, using an absolute path within the workspace:
<classpathentry kind="lib" path="/Libraries/example.jar"/>
You can also use Eclipse's "Classpath Variables" section in the preferences (in Java > Build Path > Classpath Variables), which "can be used in a Java Build Path to avoid a reference to the local file system."
Finally, you can use the "User Libraries" section in the preferences (in Java > Build Path > User Libraries) to "define a number of external archives".
精彩评论