Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
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!!