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?
It means the folder is defined as an Intellij Module. Complete list of Intellij icons: https://www.jetbrains.com/idea/help/symbols.html. Follow this answer to receive notifications. edited Mar 15, 2018 at 13:20.
Be sure that you have the module for the project set to the Java JDK. Otherwise, try putting a break point on the only executable line in the code and enter debug mode.
It means those files aren't part of the project settings. Show activity on this post. mark the java folder as source root.It will solve.
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".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With