Eclipse cannot be re-compiled

Source: Internet
Author: User

 

A strange problem occurred a few days ago. The eclipse class was always unable to be compiled. I checked it online and found that the jar package was lost. Check whether the jar package is missing, I accidentally deleted an external jar and added it to the project to solve the problem.

Now post the original article:

Sometimes, when using eclipse or myeclipse, it is found that it cannot be automatically compiled. The class file is missing in the web project!

The first one may be that your automatic compilation is not open: Project-> build automatically; (I rarely use it, only after modification, manually build all)

The second one should pay attention to whether there is a Red Cross in your project. Eclipse does not compile automatically when the project reports an error. You can check whether there are some class errors or whether the "build path" is complete, especially when the sub-debugging program is changed, some jar package import paths are incorrect.

We usually encounter the second one, that is, some packages are available on other machines, but the same path to your machine does not exist. Deleting the package is related to that package, or Add a new package path.

Eclipse does not compile the project. How to refresh the classes directory is empty.

All operations are performed:

Open project> build automatically.

Open the project --> build automatically. In addition, the clean command may compile, and the result may not work. (generally, run the project --> clean… first ..., Then execute build automatically)

By default, automatic compilation is selected for eclipse. Even if you cancel Automatic compilation, you cannot manually build the project.

There are several reasons for this:

1. if a jar package is introduced in the project and you delete the package, no error will be reported but the class file cannot be compiled, you can delete all packages and then introduce them one by one (required). Do not introduce all packages at once. Useless Packages may cause adverse consequences.

2. You want to delete a class file and regenerate it. After deleting the class file, the folder under the classes directory is opened by other programs, such as total commander. At this time, the compilation will not pass. In problems, the system may prompt "Con & apos; t Delete classes ......". Turn off other programs and re-compile them.

3. In other cases, remove the JRE system library and re-import it to compile. However, it is unclear why.

4. The project references other projects, and the referenced project references a non-use jar package.

5. There is an error message in the maven pom file (as long as there is a cross-fork or exclamation point in the project, you cannot build the project). For the solution, see my other blog.

If Maven is used, you can jump to the project path and execute

MVN compile, You can compile this project. Or MVN install. Replace eclipse compile and install.

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.