问题描述
我们有一个简单的实用程序应用程序,它可以读取 JRE 中使用的所有时区数据,并将其全部显示在一个简单的表格中.我们需要为即将发布的产品版本使用旧版本的 JRE (6_24)(显然是由于其他问题),但我们还需要在该版本中包含较新的时区更新(否则将包含在 6_29).我们已经打包了一个将要安装的私有 JRE,因此使用 TZUpdater 工具 不是问题 - 问题是读取/验证哪个版本的 tzdata(例如 tzdata2010o、tzdata2011k)正在使用实用程序应用程序读取(即,在运行应用程序的 JRE 中使用的版本).该应用当前在标题栏中显示 JRE 版本,但随着时区更新,这已不足以确定正在使用的 时区数据 版本.p>
我查看了 时区 类,但它似乎没有提供此信息 - 也许有一个系统属性包含此信息?TZUpdater 工具知道正在使用哪个版本,因此它必须在某个地方可用 - 我无法想象他们会分析确定更新工具中正在使用哪个版本...有人知道在哪里可以找到此信息吗?
在我的一个 JRE 中,JRE_PATHlibzi 中有一个名为 ZoneInfoMappings 的文件.在第一行,它显示了您要查找的数据.
我将寻找一种不那么骇人听闻的方式,如果我发现了什么,我会更新答案.
更新:似乎没有 API 可以获取这些数据.但是,sun.util.calendar.ZoneInfoFile 类中的代码显示了如何解析它.
We have a simple utility app that reads all the time zone data used in a JRE and displays it all in a simple table. We need to use an older version of the JRE (6_24) for an upcoming product release (due to other issues apparently), but we also need to include newer time zone updates in that release (that would otherwise be included in, say, 6_29). We're already packaging a private JRE that will be installed, so getting the time zone updates into that private JRE using the TZUpdater tool is not the issue - The issue is reading/verifying which version of the tzdata (e.g. tzdata2010o, tzdata2011k) is being read with the utility app (i.e. which version is being used in the JRE the app is running in). The app currently displays the JRE version in the title bar, but with the time zone updates, that's no longer sufficient to determine which time zone data version is in use.
I've looked into the TimeZone class, but it doesn't seem to provide this information - perhaps there is a system property that holds this info? The TZUpdater tool knows which version is being used, so it must be available somewhere - I can't imagine they would analytically determine which version is in use in the update tool... Anybody know where to locate this info?
In one of my JREs, there's a file in JRE_PATHlibzi named ZoneInfoMappings. In the first line it displays the data you are looking for.
I'm going to search for a less hackish way, will update answer if I find something.
UPDATE:
Seems that there's no API to get this data. However, the code in the class sun.util.calendar.ZoneInfoFile shows how to parse it.
这篇关于Java - 查找正在使用的 tzdata 版本,无论 JRE 版本如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)