Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Error in sling Servlet

Avatar

Level 5

I tried using java datetimeformatter for some date manipulation in a sling servlet and ended up with the following error. I think the import statement is also correct. [import java.time.format.DateTimeFormatter;]

Error : 

Only a type can be imported. java.time.format.DateTimeFormatter resolves to a package

 

Request your suggestions. Thanks in advance. :)

1 Accepted Solution

Avatar

Correct answer by
Employee

this class is only available since java 1.8 - are you running AEM on java 1.8?

View solution in original post

3 Replies

Avatar

Level 2

Please share your entire code..

Avatar

Correct answer by
Employee

this class is only available since java 1.8 - are you running AEM on java 1.8?

Avatar

Level 5

That's the mistake. Thank you for pointing it!!