错误:无法找到或加载主类,原因是:java.lang.ClassNotFoundException:

ht4b089n  于 2023-03-21  发布在  Java
关注(0)|答案(1)|浏览(306)

Eclipse IDE 2023-03、Windows 11 x64、JDK 19。

C:\Users\admin>mvn -v
Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: D:\tools\apache-maven-3.9.1
Java version: 1.8.0_202, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_202\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

文件app.java

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class App {

    public static void main(String[] args) {
        SpringApplication.run(App.class, args);
    }

}

错误:

Error: Could not find or load main class, Caused by: java.lang.ClassNotFoundException:

我试过用IntelliJ IDEA,作为Maven项目打开,没问题

怎么修?好奇怪

shyt4zoc

shyt4zoc1#

错误消息未正确反映原因。
有lib(依赖项)无法下载。修复所有依赖项,即delcaring和repositories声明的work/可以访问。将修复此问题。

相关问题