Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class not found in module warning when try to create Run/Debug Configuration in Intellij

Tags:

Trying to create a Run configuration in Intellij For a Java application and get a warning that Class not found in module and it doesn't create the Run configuration. This only happened once I added the project to BitBucket. Before that it ran fine.

like image 622
user840930 Avatar asked Aug 30 '18 07:08

user840930


People also ask

How do I get to the run debug configuration in IntelliJ?

From the main menu, select Run | Edit Configurations. Alternatively, press Alt+Shift+F10 , then 0 . on the toolbar or press Alt+Insert . The list shows the run/debug configuration templates.

How do I fix run configuration in IntelliJ?

Open the Run/Debug Configuration dialog in one of the following ways: Select Run | Edit Configurations from the main menu. With the Navigation bar visible (View | Appearance | Navigation Bar), choose Edit Configurations from the run/debug configuration selector. Press Alt+Shift+F10 and then press 0 .

How do I specify a module in IntelliJ?

Select the top-level directory in the Project tool window and press Alt+Insert or select New | Module from the context menu. The New Module wizard opens. From the list on the left, select a module type. Name the new module.

Where is the main class in IntelliJ?

2) "Run" menu -> " Edit configuration " -> delete the profile -> add back the profile ("Application" if it's a Java application), choose your main class from the "Main Class" dropdown menu. 3)"Build" menu -> " Rebuild Project ". Show activity on this post. Then open the project with IntelliJ.


2 Answers

None of the above worked, I had to do:

File -> Invalidate Caches/ Restart

Upon restart it re-indexed all files and everything worked again as expected.

like image 181
Martin Schüller Avatar answered Oct 02 '22 05:10

Martin Schüller


The way I fixed the problem was to remove the existing Content Root from the project and adding a new one. For some reason, it looks like it got corrupted.

File->Project Structure under Modules : then on the far right side of the screen where it says Add Content Root, remove the existing Content Root and add it back again pointing to the correct location.

like image 34
user840930 Avatar answered Oct 02 '22 06:10

user840930