Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Spring Basics Modeling, Storing, and Presenting Data Modeling Data with POJOs

Brandon Adams
Brandon Adams
10,325 Points

Errors with LocalDate

I'm getting red errors in my code on the LocalDate Classes. "Usage of API which isn't available at the configured language level", it asks if I want to mark it depreciated.

4 Answers

Seth Kroger
Seth Kroger
56,413 Points

There's a line in your build.gradle file that says sourceCompatibility = 1.5 that needs to be removed. Delete it and refresh gradle.

Brandon Adams
Brandon Adams
10,325 Points

Deleted that line, still not working.

Edward Poon
Edward Poon
9,313 Points

The above didn't work for me but what did was going to file -> project structure -> project settings -> modules and selecting giflib_main and giflib_test and setting the language to 8

Brian DuPont
Brian DuPont
30,448 Points

I had the same problem. I made sure my project SDK was 1.8 and project language level was 8, which it was. What fixed it was my build.gradle file. Like Seth Kroger suggested, I changed sourceCompatibility = 1.5 to 1.8 (also I deleted that line and that worked as well). Thanks guys

Kourosh Raeen
Kourosh Raeen
23,733 Points

The LocalDate class requires Java 8. Go to Project Settings and make sure that Project SDK and Project Language Level are set to Java 8.

Brandon Adams
Brandon Adams
10,325 Points

Good idea, but I set everything to 1.8 and still having the error.

Kourosh Raeen
Kourosh Raeen
23,733 Points

Try rebuilding the project and see if that gets rid of the error.

Good things Brandon, but what Kourosh is talking about is the a setting in the Project Structure. Go to File>Project Structure and in Project language level select "8 - Lambdas, ....".

Brandon Adams
Brandon Adams
10,325 Points

Still didn't resolve the issue, but I think you are close because it said 'source value 1.5 is obsolete' even though I have everything set on 8 and rebuilt. When I launch the server it is showing the old version of the page.