We\'re creating a new project in IntelliJ and must have something wrong because when we right click on a directory, select New and then get the context menu, Java b
If you open your module settings (F4) you can nominate which paths contain 'source'. Intellij will then mark these directories in blue and allow you to add classes etc.
In a similar fashion you can highlight test directories for unit tests.
There is another case where 'Java Class' don't show, maybe some reserved words exist in the package name, for example:
com.liuyong.package.case
com.liuyong.import.package
It's the same reason as @kuporific 's answer: the package name is invalid.
This can also happen if your package name is invalid.
For example, if your "package" is com.my-company
(which is not a valid Java package name due to the dash), IntelliJ will prevent you from creating a Java Class in that package.
The directory or one of the parent directories must be marked as Source Root
(In this case, it appears in blue).
If this is not the case, right click your root source directory -> Mark As -> Source Root.
you need to mark your directory as source root (right click on the parent directory)
and then compile the plugin (it is important )
as result you will be able to add classes and more
Project Structure->Modules->{Your Module}->Sources->{Click the folder named java in src/main}->click the blue button which img is a blue folder,then you should see the right box contains new item(Source Folders).All be done;