调用 TimeZone.getAvailableIDs() 时出现 NullPointerException [英] NullPointerException when calling TimeZone.getAvailableIDs()
问题描述
我尝试了很多我基本上做的代码示例
I tried many examples of code where i do basically
String[] IDs = java.util.TimeZone.getAvailableIDs();
它不起作用.我还尝试了另一帧示例代码,即 this 并返回:
and it doesn't work. I've also tried another frame of example code, i.e. this and it returns:
at sun.util.calendar.ZoneInfoFile.getZoneIDs(ZoneInfoFile.java:785)
at sun.util.calendar.ZoneInfo.getAvailableIDs(ZoneInfo.java:560)
at java.util.TimeZone.getAvailableIDs(TimeZone.java:508)
at TimeZoneDemo.main(uu.java:6)
我也尝试重新安装 JRE 和 JDK,但错误仍然存在.那么有什么意义呢?当我尝试执行 String[] eg = {"one","two"};
时,它可以工作.
I tried also to reinstall the JRE and JDK, but the error persists. So what's the point?
When I try to do String[] eg = {"one","two"};
it works.
推荐答案
你会在这里发现同样的问题:
You'll find the same problem here:
https://jira.atlassian.com/browse/FE-2662一个>
http://bugs.sun.com/view_bug.do?bug_id=6529213
建议:
下载并运行最新的tzupdater工具,看看是否能解决问题:
Download and run the latest tzupdater tool, and see if it resolves the problem:
这篇关于调用 TimeZone.getAvailableIDs() 时出现 NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!