Check out our Angular Book Series.

Why can't IntelliJ find java.time with JDK 9?

I've been working on a a few projects that use the JDK 9 with IntelliJ. My latest started getting an error like this:


java package java.time does not exists
java cannot find symbol
symbol: class LocalDate

The LocalDate class was added to the JDK 8, so this error makes sense if you are building using an earlier version of JDK. But, I should not be seeing it when using JDK 9.

Googling on similar errors seems to bring me back to the same thing I already knew. You're using the wrong version of the JDK, be sure to upgrade to JDK 8 or later.

But, I am already using JDK 9, so should not be having this problem.

I spent an hour pouring over IntelliJ settings before stumbling onto this screen:

The Java Compiler target bytecode version of my project was set to 1.7 instead of 9. I already fixed that in the screenshot above. It made my errors go away immediately.

The most confusing thing is that I didn't have errors on any of the other projects.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
All Content Copyright 2005, 2006, 2007, 2008, 2009 Jeffry Houser. May not be reused without permission
BlogCFC was created by Raymond Camden. This blog is running version 5.9.2.002.