Fix intellij cannot add java file

This would usually be because of the way your project is setup. It may not be setup correctly to indicate where your source code is.

  • To setup your project, in the Project Tab, click on the top most folder and select F4. This should bring up the Project Settings dialog window.
  • Now click on Modules in the LHS, and then select the Sources Tab on the RHS
  • Select your src folder and click on the Sources button, to indicate this is your source folder. Now IntelliJ is aware that this is where your code is.
  • Click on Apply and OK. This should close the Dialog Window.
  • Now right click on the src folder and then select New -> Java Class to create your Java class

Reference: https://stackoverflow.com/questions/38254612/intelli-j-cannot-create-class-file

Leave a comment

Design a site like this with WordPress.com
Get started