A Java package is essentially a folder in your Java project. The hierarchy of Java packages in a project maps to a hierarchy of folders in the file system. Because of this relationship, Project Explorer provides two ways to view your Java project: directory view and package view.
Directory view, the default view, displays a hierarchical list of all project subfolders, according to the project directory structure on the hard disk. Each Java package in the project is displayed as a subfolder. Package view displays project subfolders as Java packages, in a flat list. Note that package view displays only .java files and the folders that contain .java files. Each folder that is displayed is listed by its fully-qualified package name. The project node itself is considered the default package.
The following diagram shows the same project in both directory view and package view:
Directory View | Package View |
|
|
For more information about the relationship between Java packages and the file system, see Storing Packages in a File System in the Java Language Specification.
To view the project in package view
Note The structure of files and folders displayed in package view is based on the location of the .java files, not the location of the built .class files. Therefore, if the package statements in the .java files do not match their location on the hard disk, package view will not accurately display the packages in your project.
To view the project in directory view
By default, Project Explorer does not display any nonproject files and folders that reside in the project directory structure on the hard disk. However, if the project view is set to directory view, you can display these items by clicking the Show All Files button in Project Explorer. Note that in package view, this button is disabled. For more information about nonproject items that reside in the project directory structure, see Displaying All Files in the Project Directory Structure.