The import javax.annotation.Resource cannot be resolved

10,691

Solution 1

Eclipse is facing some bugs in IDE 4.7 it is not fully compitable with JDK 9 like in with JDK 9 IDE is not generating toString() function also...

so i change the JDK 9 to jdk 8.1 and it solves all the problem.

to change the JDK...

Window > Preferences > Installed JREs >>> Change the JDK 9 to JDK xx

AND/OR

Right Click Project > Properties > JRE > Edit >>> YOUR ALTERNATIVE JDK xx

This had solved my problem.

Solution 2

I have encountered the same problem with you.
Download javax.annotation.jar online and add to your library may help.

Share:
10,691
Muhammad Siddique
Author by

Muhammad Siddique

~I'm an experienced & detail-oriented software Engineer working with multinational and Pakistan's top software house. possessing a proven track record to develop web application & deliver enterprise microservices applications on time. Proficient in object-oriented design & development. Highly skilled in Software development by using best practices and highly available architecture to deliver compelling business value.

Updated on June 13, 2022

Comments

  • Muhammad Siddique
    Muhammad Siddique almost 2 years

    I have tried to resolve by adding missing/unnecessary jar's but nothing works for me. if you know how to resolve this issue then kindly help... Thank you in advance.

    Code IDE ERROR

    I am using JDK 9.0.4 installed in this IDE Eclipse 4.7 Oxygen December 2017

    Windows 10

    Servlet 4.0

    JSP 2.3

    JSTL tags

  • Admin
    Admin over 5 years
    This fixed my problem.
  • Otti
    Otti almost 4 years
    Just mention, in Eclipse Version: 2020-03 (4.15.0) " Installed JREs" is located under the "Java" menu point. So, the path to making the aforementioned changes is the following: Window > Preferences >Java >Installed JREs.
  • Muhammad Siddique
    Muhammad Siddique almost 4 years
    @Otti Indeed thanks for update this comment really helps.