. Advertisement .
. Advertisement .
The “Error: Could not find or load main class cucumber.cli.Main” error happens when the necessary dependencies of your ‘cucumber.rb’ files are not met. This may happen if the ‘Gemfile’ of your project is not updated to reflect the current requirements of ‘cucumber’ and the rest of the framework you have installed. Check out this post for a quick fix.
How Does The Error “Error: Could not find or load main class cucumber.cli.Main” Occur?
In Intellij, you may get the following error.
Error: Could not find or load main class cucumber.cli.Main
How To Fix The Error “Error: Could not find or load main class cucumber.cli.Main”?
Approach 1: Include the dependency below to pom.xml
All you have to do now is including the dependency below to your pom.xml file.
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java --> <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-java</artifactId> <version>5.7.0</version> </dependency>
Now, you have fixed your error.
Approach 2: Delete all configurations
Excepting the solution mentioned above, there is another solution for you to solve the error “Error: Could not find or load main class cucumber.cli.Main”. Let’s follow this guide:
In our case, we discovered that the Run configuration was incorrect due to the refactoring and defaulted, leading to an error.
The solution is to delete all configurations by using the drop-down menu in the top right corner of the image, and uninstall cucumber Java by choosing it and hitting the “-“.
Then we performed a right-click on the main application we wanted to launch and chose run, or for a shortcut, ctrl + shift + F10.
You can do as the bove guide, it is very effective your error. It wll make your error completely disappear and your program will run well without any errors. So, let’s do it to get your desired results.
We hope you will enjoy our article about fixing the error “Error: Could not find or load main class cucumber.cli.Main”. We know that this error can be frustrating to deal with, so we hope that our information has helped you fix it. If you have any other questions or concerns about working with Conda, please leave a comment below. Thank you for reading; we are always excited when one of our posts can provide useful information on a topic like this!