在Java 17中的NoclassDeffoundError在终端上运行生成的罐子时
我正在尝试使用./gradlew Clean Build生成的JAR,但是我总是在线程“ Main” Java.lang.noclassdeffounderror中获得此错误例外:org/springframework/boot/boot/springapplicationation 我正在使用Java -jar命令
plugins {
id 'org.springframework.boot' version '2.7.0'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
jar {
enabled = true
}
bootJar {
enabled = false
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation('jakarta.xml.bind:jakarta.xml.bind-api:2.3.3')
}
jar {
manifest {
attributes 'Main-Class': 'com.test.test.TestApplication'
}
}
上面是我的build.gradle文件。我已经使用spring initializr.i创建了我的项目。我已经使用java 11测试了同一项目,它起作用了,为什么这会导致Java 17的问题17有人可以告诉我有什么问题
I am trying to run my jar generated using ./gradlew clean build but I always get this error Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
I am using java -jar command
plugins {
id 'org.springframework.boot' version '2.7.0'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
jar {
enabled = true
}
bootJar {
enabled = false
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation('jakarta.xml.bind:jakarta.xml.bind-api:2.3.3')
}
jar {
manifest {
attributes 'Main-Class': 'com.test.test.TestApplication'
}
}
The above is my build.gradle file.I have created my project using spring initializr.I have tested the same project using java 11 and it worked fie why is this causing issue with java 17 can anyone tell me what is the issue
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论