gpt4 book ai didi

java - 骡子 - NoClassDefFoundError : Could not initialize class java. time.zone.ZoneRulesProvider

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:49:49 43 4
gpt4 key购买 nike

我一直在努力解决这个问题,但没有运气,希望有人能帮助我......

我创建了一个 DateUtil.java 类,它位于我的项目中:src/main/java/util/DateUtil.java

我使用调用组件调用“convertTime”方法,在我的本地笔记本电脑上一切正常,但是当部署到本地服务器时,我在日志中收到以下错误

根异常堆栈跟踪:

java.lang.NoClassDefFoundError: Could not initialize class java.time.zone.ZoneRulesProvider
at java.time.ZoneRegion.ofId(Unknown Source)
at java.time.ZoneId.of(Unknown Source)
at java.time.ZoneId.of(Unknown Source)
at util.DateUtil.convertTime(DateUtil.java:25)

DateUtil.class 使用以下 Java 类

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

在此先感谢您的帮助:)

最佳答案

正如您在评论中指出的那样,您正在使用 jre.1.8.0_131。请尝试使用 JDK 本身(而不是 JRE)。

JDK 1.8 Downloads.

关于java - 骡子 - NoClassDefFoundError : Could not initialize class java. time.zone.ZoneRulesProvider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45493099/

43 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com