Published 27 Aug, 2022

Java - How to fix tzdb.dat not found error in java?

Category Java
Modified : Sep 29, 2022

When I try to connect my gradle project with sqlite database, I have an error:

Exception in thread "main" java.lang.Error: null\lib\tzdb.dat (The system cannot find the path specified)
        at sun.util.calendar.ZoneInfoFile$
        at Method)
        at sun.util.calendar.ZoneInfoFile.<clinit>(
        at sun.util.calendar.ZoneInfo.getTimeZone(
        at java.util.TimeZone.getTimeZone(
        at java.util.TimeZone.setDefaultZone(
        at java.util.TimeZone.getDefaultRef(
        at java.util.TimeZone.getDefault(
        at org.sqlite.core.CoreConnection.<init>(
        at org.sqlite.jdbc3.JDBC3Connection.<init>(
        at org.sqlite.jdbc4.JDBC4Connection.<init>(
        at org.sqlite.SQLiteConnection.<init>(
        at org.sqlite.JDBC.createConnection(
        at org.sqlite.JDBC.connect(
        at java.sql.DriverManager.getConnection(
        at java.sql.DriverManager.getConnection(
        at repository.JdbcUtils.getNewConnection(
        at repository.JdbcUtils.getConnection(
        at repository.RepositoryLog.findOne(
        at Main.main(
    Caused by: null\lib\tzdb.dat (The system cannot find the path specified)
        at Method)
        at sun.util.calendar.ZoneInfoFile$
        ... 21 more

I've tried to debug it but it says that it is a timezone problem and I don't know why this issue appears. I thought that this could be a a problem because of Java10, so I also installed Java1.8 but it didn't work.

        private Connection getNewConnection()

    //I use the driver and the url from a bd.config file and it is saved in my //variables corectly

               String driver= jdbcProps.getProperty("jdbc.driver");
               String url=jdbcProps.getProperty("jdbc.url");
               String user=jdbcProps.getProperty("jdbc.user");
               String pass=jdbcProps.getProperty("jdbc.pass");

               Connection con=null;
             //this is where my error appears
                   con= DriverManager.getConnection(url);
               } catch (ClassNotFoundException e) {
               } catch (SQLException e) {
                   System.out.println("Error getting connection "+e);
               return con;

I expect only to connect to my database and work with the database corectly


There are 2 suggested solutions here and each one has been listed below with a detailed description. The following topics have been covered briefly such as Java, Gradle, Sqlite. These have been categorized in sections for a clear and precise explanation.


Go to your C:\Program Files\Java\jre1.8.0_202\lib directory search for tzdb.dat file and copy it from here and paste in C:\Program Files\Java\jdk-13\lib directory hope it will work


I Just had this problem and could only find this Question when I Googled it.

I eventually fixed it by following a hint on an Mboard ([email protected]) They mentioned doing: System.setProperties(null); somewhere, This has the effect of deleting all System variables.

When using a Properties p = new Properties(); You have a blank set of System variables. Therefore doing System.setProperties(p); has the same effect as above.

If you want to add a new variable then you should first get the Properties with

Properties p = System.getProperties();

Then add your new ones:

p.setProperty("MyProperty", "MyValue");

and then write it back with the set method.

I hope this helps someone in the Future.