开发者

The package collides with a type in java code

开发者 https://www.devze.com 2023-03-28 11:30 出处:网络
I have a question about eclipse version 3.6.1. I had run my code well before, but now I open the eclipse and my code appear red line at the package.

I have a question about eclipse version 3.6.1.

I had run my code well before, but now I open the eclipse and my code appear red line at the package.

The error message is The package com.test collides with a type开发者_Go百科.

How should I solve this problem?

My code is as the following:

package com.test;

public class test extends Activity{

.....

.....

}

Thank you for your help~:)


I've changed the class name and the file name to Test, but it always wrong at the package com.test;, I have no idea about that problem.

At this point, Eclipse could just be confused.

Do a "project > clean" on all projects in your workspace. If that fails try the various other tricks that are typically used to de-confuse Eclipse.


Even after i corrected the naming conflicts and changed the package declaration to match its location, Eclipse showed this error message.

I deleted my project from the Eclipse package explorer(not from the computer) and then imported the same project after restarting the Eclipse. Problem solved!


The easiest solution is to follow the Java naming convention whereby class names start with an uppercase letter; so Test rather than test.

0

精彩评论

暂无评论...
验证码 换一张
取 消