Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The package collides with a type in java code

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.
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~:)

like image 489
solar Avatar asked Aug 17 '11 08:08

solar


2 Answers

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.

like image 87
Stephen C Avatar answered Oct 09 '22 20:10

Stephen C


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!

like image 34
Narbhakshi Avatar answered Oct 09 '22 19:10

Narbhakshi