Broken References: Why aren't my projects referring to each other using relative paths?

Q: I have set up a couple of projects, and put one project in the classpath of the other. (Or, I have added a JAR file in a lib directory to the classpath of a project, etc.) But NetBeans seems to be storing absolute paths from one to the other. When I back up my project, or try to send my projects to a colleague, we get a Broken References warning and have to set up all the paths manually again. What do I do?

A: Every time you add a library, the dialog window offers you a choice between absolute and relative references.

If the project has a defined library folder (aka when it's "sharable") then every effort is made to make relative paths work. However if it's not sharable, absolute paths are used as the project. Even if it's sharable, the IDE only suggests what type of reference shall be used (absolute, relative, copy to libraries folder) based on relative position of project, library folder and the JAR/other project in question. Presence in version control system also plays a role.

Applies to: NetBeans 6.1 and newer

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo