Managing the Classpath

See Also 

Adding a group of class files to a project's classpath tells the IDE which classes the project should have access to during compilation and execution. The IDE also uses classpath settings to enable code completion, automatic highlighting of compilation errors, and refactoring.

Classpath and Standard Projects

For , the IDE maintains separate classpaths for compiling and running your project, as well as compiling and running JUnit tests. The IDE automatically adds everything on your project's compilation classpath to the project's runtime classpath.

To edit a standard project's classpath:

  1. Expand the project node, right-click the Libraries node, and choose Properties.
  2. In the Project Properties dialog box, add the necessary elements to the project's compilation classpath by clicking the appropriate button. You can add any of the following:
  3. (Optional) In web applications, click the Deploy checkbox if you do not want to package an element in the web application. By default, all classpath elements are included in the web application.
  4. (Optional) Click the Build Projects on Classpath checkbox if you do not want to rebuild all projects on the classpath whenever you build the current project. By default, all projects on the classpath and, in web applications, projects listed in the Packaging page, are rebuilt when you build the current project.
  5. (Optional) Click the Move Up and Move Down buttons to alter the classpath priority.
  6. (Optional) Click the Run, Compile Tests, or Run Tests tabs to make any changes to the these classpaths.

Classpath and Free-Form Projects

In , your Ant script handles the classpath for all of your source folders. The classpath settings for free-form projects only tell the IDE what classes to make available for code completion and refactoring. In order to change a free-form project's actual compilation or runtime classpath you must edit your build.xml file directly.

Note that free-form projects do not have Library nodes nor do free-form project's Project Properties dialog boxes include a Libraries panel. For more information, see Declaring the Classpath in Free-Form Projects.

See also
Creating Dependencies Between Projects
Setting the Main Class and Runtime Arguments
Setting the Target JDK
Adding Javadoc to a Project

Legal Notices