Setting the Classpath

In order to utilize Java packages in your projects, it is important that the packages be available on the Classpath. The Classpath is a path the compiler uses to find packages that you reference in your projects. You can add a package to the Classpath by either adding it to your Autoexec.bat file, if you are running Microsoft Windows; or to the environment settings if you are running under Microsoft Windows NT. The following is an example of a Classpath entry:

SET CLASSPATH=%PATH%;C:\MYPACKAGE;

You may want to have a path added to the Classpath for your Java project. The Classpath tab of the <Project> Properties dialog box allows you to add and remove paths that are related to your project.

To display the Classpath tab

  1. On the Project menu, click <Project> Properties (where <Project> is the name of the project that is currently selected in the Project Explorer).

    The <Project> Properties dialog box appears.

  2. Select the Classpath tab.

  3. In the Configuration drop-down list, choose the build configuration for which you want the Classpath tab settings to apply.

To add a path to the project specific Classpath

  1. On the <Project> Properties dialog box, click the New button.

    The Extended Project-specific Classpath dialog box appears.

  2. Enter the path that you wish to add to your project's Classpath. If the path you define does not exist, Visual J++ will ask you if you want to add the path regardless of the path's existence.

  3. Click OK.

    The path is added to the list of paths.

Note   If you have multiple projects open in Visual J++, you can merge all the project-specific Classpaths into a consolidated "solution-specific" Classpath. To do this, click the Merge all Project-specific Classpaths in Solution check box.

To delete a Classpath from the list, select the Classpath in the list and then click Delete. You can also use the Up or Down buttons to change the order of the Classpaths in the list.