When you create a project, the IDE sets up a default classpath for you based on the project template you are using. If you have other things to add to the classpath, you can do so through the Libraries node of the project. In fact, the IDE distinguishes among several types of classpaths, depending on project type, such as compilation classpath, test compilation classpath, running classpath, and test running classpath. The compilation classpath typically serves as a base for the other classpaths (for example, other classpaths inherit what is in the compilation classpath). To add an item to the compilation classpath (and, thus, the other classpaths as well), right-click the project's Libraries node and choose Add JAR/Folder (see Figure 2-2). Figure 2-2. Projects window, adding a JAR file to the classpath
You can edit other classpaths in the Properties dialog box for a project. To open the Project Properties dialog box, right-click the project's node in the Projects window and choose Properties. In the dialog box, click the Libraries node and use the customizer in the right panel to specify the different classpaths (see Figure 2-3). Figure 2-3. Project Properties dialog box, Libraries page |