< prev index next >

src/java.base/share/classes/java/time/zone/TzdbZoneRulesProvider.java

Print this page

        

@@ -104,14 +104,19 @@
      *
      * @throws ZoneRulesException if unable to load
      */
     public TzdbZoneRulesProvider() {
         try {
-            String libDir = System.getProperty("java.home") + File.separator + "lib";
+            String pathToRules = System.getProperty("jdk.time.tzdbfile");
+            if (pathToRules == null) {
+                 pathToRules = System.getProperty("java.home") + File.separator + "lib" +
+                     File.separator + "tzdb.dat";
+            }
+
             try (DataInputStream dis = new DataInputStream(
                      new BufferedInputStream(new FileInputStream(
-                         new File(libDir, "tzdb.dat"))))) {
+                         new File(pathToRules))))) {
                 load(dis);
             }
         } catch (Exception ex) {
             throw new ZoneRulesException("Unable to load TZDB time-zone rules", ex);
         }
< prev index next >