【问题标题】:Not able to run program in Intelij无法在 Intellij 中运行程序
【发布时间】:2019-10-26 21:39:22
【问题描述】:

我尝试使用 IntelliJ 中的播放/调试按钮运行或调试程序,但出现错误:无法找到或加载主类

我在Spring Boot Program cannot find main class做了很多事情 不工作。 但是当我使用命令行并运行时: mvn spring-boot:run 应用程序正在运行并且运行良好。

我的主要方法如下:

@SpringBootApplication
public class HomeworkApplication {

    public static void main(String[] args) throws IOException {
        SpringApplication.run(HomeworkApplication.class, args);
        JsonData jsonData = new JsonData();
    }
}

我只想通过 IntelliJ 运行和调试。

【问题讨论】:

    标签: java spring spring-boot intellij-idea configuration


    【解决方案1】:

    试试这些步骤:

    • 转到文件 |项目结构,或按 Crtl+Shift+Alt+S
    • 在项目设置部分下选择模块。
    • 在“来源”选项卡中,单击“标记为:”行上的来源。
    • 点击应用按钮。

    【讨论】:

      【解决方案2】:

      试试这个: 转到主类上的 Edit Configuration,然后转到 Before launch: Build, Activate tool window 部分下方,然后单击 + 按钮并添加 Build如果没有添加。

      【讨论】:

        猜你喜欢
        • 2018-03-24
        • 2015-09-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-11-28
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多