Xxx cannot be resolved to a type Error solution, cannotresolved

Source: Internet
Author: User

Xxx cannot be resolved to a type Error solution, cannotresolved

Xxx cannot be resolved to a type

Introduction:

Newly imported eclipse projects often see the error message "XX cannot be resolved to a type. This article will make a summary.
Body:
(1) jdk does not match (or does not exist)

The jdk specified by the project is "jdk1.6.0 _ 18", and currently eclipse uses "jdk1.6.0 _ 22 ". You need to make a simple adjustment in BuildPath | Libraries.
(2) The jar package is missing or conflicted.
This error is reported if the jar package where "XX" is not found. To solve this problem, you only need to find the corresponding jar package import Project (ctrl + Click to see the jar package name.
In addition, this error is also reported when the same XX occurs. You may need to transfer the package, unpackage, and delete the package.
(3) Why does eclipse search for a project type policy?
In eclipse, the above two items have been compared. If there is no problem, you can still report this error. In this case, you need to operate Project | Clean... to solve the problem. The reason is the mechanism. For some special reasons, eclipse fails to automatically compile the source code to build/classes (or other classes Directories), leading to the failure to find the type.

These are common errors. The errors I encountered here are caused by file encoding!

The error is similar. Here, only part of the error is intercepted:


Solution:

Right-click a project with an error and choose Properties

Select Resource on the left, Text file encoding on the right select Other: UTF-8, and click Apply.



String cannot be resolved to a type. How can this problem be solved? Below is an error in the source code

Cannot be resolved to a type. This problem is generally caused by the failure to identify this type because the jar package is not introduced, but you cannot identify this type because your eclipse does not find JDK, set it in the preference and re-compile it.

The error message "cannot be resolved to a type" is displayed. How many methods can be used?

Cannot be resolved to a type
Is an unrecognized type, that is, your code may have
1. unimported packages.
2. Wrong Class Name.
3. unused variables.

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.