Reputation: 5176
I have a project structure like this:
src (sources root)
---main
-------java (sources root)
-----------com
--------------requests
----------------------File1.java (needs to be package com.requests)
----------------------File2.java (needs to be package com.requests)
----------------------File3.java (needs to be package com.requests)
--------------things
--------------util
--------------web
-------resources
----------------images
-------webapp
-------------WEB-INF
--------------------classes
---------------------------com
------------------------------requests
------------------------------things
------------------------------util
------------------------------web
---------------------lib
However, File1.java
, File2.java
and File3.java
don't seem to be recognized as Java files and I can't compile them:
Why? How do I fix it?
Upvotes: 5
Views: 3989
Reputation: 44980
You should unmark src
directory as a source root because it doesn't contain Java code. In your example only src/main/java
directory should be marked as source root.
You can do it by right clicking on src
and selecting "Mark Directory as" > "Unmark as Source Root".
Upvotes: 8