Managing the project build path

The build path is a list of JARs, classes, and source file folders in which Eclipse will look to resolve dependencies. You can edit the build path for a project by entering the project's properties and selecting Java Build Path. The configuration options have been divided into four tabs:

  • Source: This contains options to manage the project's source folders. It allows you to create new source folders and add links to external sources in the filesystem.
  • Projects: You can manage you project's dependency on other projects in your workspace in this tab. When you'll add a dependency to another project, you'll have full access to all of its classes by default. However, some of these classes might not be visible when the project is compiled and executed outside Eclipse. You might end up with a project that works inside Eclipse but doesn't work when you run the JAR files outside it. To avoid these head-scratching issues, you can create access rules to external projects to keep them from using other projects' internal packages. For this, expand the required project, choose Access Rules, and click on Edit. Click on Add Access Rule and add Rule Pattern. You can discourage (compiles but shows a warning) or forbid (compiling fails with an error) access.
  • Libraries: In this tab, you'll be able to edit the libraries that will be added to the project's build path. You can add JARs and class folders from inside or outside the workspace, and you can also add libraries and variables. You can add a link from a library to its Javadoc. This will allow you to have methods and classes with comments that describe their usage, as if they were in your workspace. To add a Javadoc for a library, expand its entry in the list, select Javadoc location, and click on the Edit button. Enter the path for the Javadoc and click on OK. You can also point to the library's source if you have access to it.
  • Order and Export: This is where you'll define which source folders and libraries from the project will be exported so that other projects can import them. This tab also allows you to choose the order in which the libraries will be loaded during runtime. The order will determine which class will be loaded in case two different libraries provide that same class. To increase or decrease a library's priority, select it and press the Up and Down buttons.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset