Search code examples
eclipsebuildpath

What does "Add Variable" mean? and other Eclipse Java Build Path "what does this button do" questions


In the Eclipse Java Build Path wizard, what is the difference between the options given?

It seems as though Add JARs and Add Variable.. do the same thing. What do they do differently and when would you use them?

It would be much appreciated if someone can explain the function of each of the buttons in the wizard, as I have not found any such thing online or in the Eclipse literature surrounding me.

Eclipse Build Path Wizard


Solution

  • "Add variable" is used to add a JAR or directory at a location relative to a classpath variable that you have configured in your Eclipse preferences. I've used the facility when working with a team of developers sharing a related set of Eclipse projects via source control, where the projects rely on a set of JAR files on a network share that is mounted at a different location for different developers. Everyone sets the same LIB_HOME variable to point to where they have the shared folder mounted on their particular machine (e.g. L:\ on Windows, /Volumes/Libs on Mac, etc.), and the Eclipse projects then point to the required JARs relative to that variable.