The Package,source Folder,folder in eclipse

Source: Internet
Author: User
Tags tomcat
A project was recently imported with Tomcat running with a 404 error, but the Web page does exist. Look closely, the project's package icon is not the same as other projects:


This form is called folder, under Eclipse, Package,source Folder,folder are all folders.

Workaround:

Right-click the folder, (such as Controller), build path-> Include, Effect:


Here is my reference to the relevant articles according to their own understanding of the collation:

First, the definition:

SOURCE folder: The src folder, which contains the Java source code for the new project, including the package and some other files, after the project is built, the Java in the source folder is automatically compiled into a class file to the corresponding/ Web-inf/classes folder, other files will also be moved to the appropriate directory in/web-inf/classes.

Package: Is the most common naming folder similar to example.com. When a package is created, it is automatically created under the source folder and can only be built under this directory.

Folder: Inside can put any file, including Java source files, jar files, other files (such as pictures, sounds, etc.), if it contains Java source files, regardless of whether the program is correct, Eclipse will not error, treat them as ordinary file processing. But if you want to use the files in this project, the situation will be different.


Ii. Comparison of package and Sourcefolder:

Same:

The package can contain other files in addition to the Java file, and the compiled, packaged file path has the same rules as the file path under source folder. Note: In the case of Example.java under the Cc.openhome.controller package, the compiled class file path is (in the WebApps folder of the Tomcat installation directory): D:\software\ Apache-tomcat-7.0.55-windows-x64\apache-tomcat-7.0.55\webapps\bookmarkonline\web-inf\classes\cc\openhome\ Controller\example.class

Different:

1.sourceFolder by "/" to the division, the package by "." To divide the hierarchy.

2.source folder can be built under the package, but the package cannot be built under the source folder

The package attribute in the 3.java file is assigned according to the path of the "a", the source folder path does not participate in the Java file's Package property assignment, and the second one concludes that all source The package property of the Java file under folder is empty.


Three, Package,source Folder,folder between each other:

Package turns into folder display: Select Package, build path-> exclude 
folder to package display: Select folder, Build path-> includ e 

Package to source folder display: Select Package, build path-> use as source folder 
source folder to Pac Kage Display: Select folder, Build Path-> Remove from buildpath 

Pacage conversion to source folder ibid.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.