I installed IntelliJ Idea and I had a few working Java projects already on my system, but when I open and run a program from these projects the above-mentioned error is shown. I am also unable to create any new Java classes in these projects. But when I made a new project through IntelliJ no problems occurred. The problem happens only with existing projects.
2 Answers
I guess you should mark the certain folder java (whose location is src/main/java in project) as sources:
- Right Click
javafolder - Mark Directory as
- Sources Root
Image explanation:
Look like you were having a compilation issue, please check the configuration in the project settings/structure
- Project: SDK and language level
- Modules: src, target