错误:无法找到或加载主类Cucumber.cli.Main

2022-08-04 00:00:00 module refactoring intellij-idea java

将IntelliJ中的项目重新编写为模块时,我遇到以下错误:

"C:Program FilesJavajdk1.8.0_181injava.exe" "-Dorg.jetbrains.run.directory=C:UsersAshDocuments1_Code StuffJavaUdemy courseguru-pet-clinic" "-javaagent:C:Program FilesJetBrainsIntelliJ IDEA 2018.2.4libidea_rt.jar=55768:C:Program FilesJetBrainsIntelliJ IDEA 2018.2.4in" -Dfile.encoding=UTF-8 -classpath "C:Program FilesJavajdk1.8.0_181jrelibcharsets.jar;C:Program FilesJavajdk1.8.0_181jrelibdeploy.jar;C:Program FilesJavajdk1.8.0_181jrelibextaccess-bridge-64.jar;C:Program FilesJavajdk1.8.0_181jrelibextcldrdata.jar;C:Program FilesJavajdk1.8.0_181jrelibextdnsns.jar;C:Program FilesJavajdk1.8.0_181jrelibextjaccess.jar;C:Program FilesJavajdk1.8.0_181jrelibextjfxrt.jar;C:Program FilesJavajdk1.8.0_181jrelibextlocaledata.jar;C:Program FilesJavajdk1.8.0_181jrelibext
ashorn.jar;C:Program FilesJavajdk1.8.0_181jrelibextsunec.jar;C:Program FilesJavajdk1.8.0_181jrelibextsunjce_provider.jar;C:Program FilesJavajdk1.8.0_181jrelibextsunmscapi.jar;C:Program FilesJavajdk1.8.0_181jrelibextsunpkcs11.jar;C:Program FilesJavajdk1.8.0_181jrelibextzipfs.jar;C:Program FilesJavajdk1.8.0_181jrelibjavaws.jar;C:Program FilesJavajdk1.8.0_181jrelibjce.jar;C:Program FilesJavajdk1.8.0_181jrelibjfr.jar;C:Program FilesJavajdk1.8.0_181jrelibjfxswt.jar;C:Program FilesJavajdk1.8.0_181jrelibjsse.jar;C:Program FilesJavajdk1.8.0_181jrelibmanagement-agent.jar;C:Program FilesJavajdk1.8.0_181jrelibplugin.jar;C:Program FilesJavajdk1.8.0_181jrelibesources.jar;C:Program FilesJavajdk1.8.0_181jrelibt.jar;C:Program FilesJetBrainsIntelliJ IDEA 2018.2.4pluginscucumber-javalibcucumber-jvmFormatter.jar;C:Program FilesJetBrainsIntelliJ IDEA 2018.2.4pluginscucumber-javalibcucumber-jvmFormatter3.jar" cucumber.api.cli.Main --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter "C:/Users/Ash/Documents/1_Code Stuff/Java/Udemy course/guru-pet-clinic"

Error: Could not find or load main class cucumber.cli.Main

解决方案

我后来发现由于重构导致运行配置错误,然后默认,从而导致错误。

我修复它的方法是删除所有配置(图片右上角的下拉列表),并通过选择并单击"-"

删除黄瓜Java

然后,我右击要运行的主应用程序并选择运行,或者选择ctrl+Shift+F10作为快捷方式。

相关文章