Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do my java files look strange in Eclipse?

Tags:

java

eclipse

I just got confused with my Eclipse project, the java code file appears strange like this: enter image description here

It should be look like this: enter image description here

Does anyone know what is the difference of those java file? And how do I resolve this problem? Thanks and regards.

like image 920
the.wizard Avatar asked Mar 31 '15 18:03

the.wizard


2 Answers

I know this is a little late, but i had the same problem and couldn't run anything, so I did some research and found the problem was as said by Sergey, I fix it by right clicking in the Project > Build Path > Configure Build Path > Source then deleting the source path and adding the new source path, the project location. Hope it works, it worked for me

like image 99
Isaac Herrera Monge Avatar answered Sep 18 '22 12:09

Isaac Herrera Monge


It's related to how Package Explorer is showing the project content. The second one (solid blue J icon) shows Java source code while the first one shows just a folder structure with any files in it (Java files in this case). Meaning that if you fail to see the second one then your project is in trouble since there's no source code folder configured.

You could check you project sources by right click on project > Java Build Path > Source

If you want to avoid confusion then I'd recommend to use the Navigator view over the Package Explorer view cause the former shows your folder structure as it is w/o any modifications.

like image 33
Sergey Pauk Avatar answered Sep 18 '22 12:09

Sergey Pauk