Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Situation : I have a Java file in my project that uses the features of the iTextPDF library. The project compiles properly. I use JDK 1.7, Tomcat 7.45 and Eclipse Neon.3 Release (4.6.3).

Problem : While starting the server via Eclipse, I get an error: java.lang.ClassNotFoundException: com.itextpdf.text.Element

What I've tried so far:

  • Ensured that only 1 version of iTextPdf 5.4.jar is available in the entire project. It's there in WEB-INF/lib folder. It's not there in any of the externally referenced libraries.

  • I updated my Eclipse.

  • Any help will be greatly appreciated.

    Well, as a starting point- try and expanding the JAR, and see if you can search for or manually find com.itextpdf.text.Element class.

    if it's not found there, you know there's nothing wrong with your eclipse or project settings, and nothing wrong with your jar imports.

    You should then determine between 3 options:

  • Is the JAR even on the classpath? it's possible everything is present there, but the project does not even consider looking in it.
  • Should this class be in the JAR? is it available on other versions of this JAR?
  • Is this class neccesasry for you application? why is eclipse looking for it, where in the code it is referecened? can you live without it? or, can you manullay replace it with a class file you can find online? (this will take some debug time, and some more research on your part)
  • iText employee here. If it's a Maven project and the dependency com.itextpdf:itextpdf:5.5.13 was defined in pom.xml and the jar file was automatically downloaded from Maven Central, then com.itextpdf.text.Element is most definitely a class in the jar file. See also the Javadocs: itextsupport.com/apidocs/itext5/5.5.13/com/itextpdf/text/… . I would rather look in the direction of the jar not being on the clas path. Amedee Van Gasse Sep 3, 2018 at 13:37 I'm receiving same error with a couple of itext classes. In my context (ibm i rpgiv wrapper) it could be pointing to a different issue: improper use or traslation of such class (in my context, I need to define a rule of transcription for constructors and methods. If it does not describe the method/constructor accurately, it is the response in runtime) Jorge Ubeda Dec 24, 2019 at 13:25

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question . Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers .