0

How to use DateTimeFormatter of java.time package in JDK 1.8?

When I use LocalDate I've got a Noclassdeffounderror.

I changed my project from JDK 1.7 to 1.8.

Is there any jar file to be added?

Community
  • 1
  • 1

2 Answers2

0

The java.time classes are native in JDK 8, you don't need to add any other jar.

Probably there's a problem in your IDE configuration or somewhere else. But without more details, we can only guess

Sgustu
  • 1
0

The answer by Ravindra is wrong. You can use a LocalDate with a DateTimeFormatter, as soon as the formatter has only date related fields - like the built-in formatters DateTimeFormatter.ISO_DATE and ISO_LOCAL_DATE

The answer by Sgustu makes more sense. Perhaps you could try to rebuild your project or double check your JVM configuration

Newbie
  • 1
  • 1