JavaRush /Java Blog /Random EN /Error: Could not find or load main class

Error: Could not find or load main class

Published in the Random EN group
I had a similar problem. Error: Could not find or load main class - 1 After finishing Java Syntax, I started solving Java Core problems and a similar runtime error appeared. Probable cause : Changes in Run/Debug configuration templates when installing JavaFX. Error correction : 1. In the top line of the IDEA main menu, select "Run" 2. In the drop-down list of menu items, select "Edit Configurations..." Error: Could not find or load main class - 1 3. In the dialog box that opens, click on the clickable text "Edit configuration templates..." ( this text is located in the lower left corner of the dialog box) Error: Could not find or load main class - 2 4. In the new dialog box that opens, select: 4.1. In the left column: "Application". 4.2. In the field active (highlighted) on the screen, select the subfolder of the quest whose tasks you are launching for execution with the “Run” command (that is, the tasks of the current quest that you are currently completing). 4.3. In this dialog box, click “Apply” and then “OK”. Error: Could not find or load main class - 3 5. After closing the previous dialog box, click “Ok” in the “Run/Debug Configurations” dialog box, which has become active. Error: Could not find or load main class - 4 Results : 1. In the screenshots above, I saved the default launch/debug configuration for working with files in a subfolder of the Java Core project. That is, with the specified settings, I can successfully launch ALL files from the “2.JavaCore” subfolder for execution. Error: Could not find or load main class - 5 2. If it is necessary to run files from subfolders of other quests, say with "3.JavaMultiThreading", I need to change the subfolder selected by default in the "Edit configuration templates..." settings (see point 4 of the "Error correction" algorithm above) . 3. Thus, in order to launch tasks for execution from subfolders of another quest, you need to change the “Edit configuration templates...” settings once (see point 4 of the “Error correction” algorithm above). In practice, you don’t have to complete tasks from different quests: 3.1 If you complete the “Java Syntax” quest, then you launch solved tasks only from the “1.JavaSyntax” subfolder. 3.2 If you go through the next quest, “Java Core”: you launch solved tasks only from the “2.JavaCore” subfolder. 4. When I switched to a new quest (for example, from "Java Syntax" to "Java Core") I changed the "Edit configuration templates..." settings once (see point 4 of the "Error correction" algorithm above).
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION