psiegman / epublib

a java library for reading and writing epub files
http://www.siegmann.nl/epublib
1.06k stars 317 forks source link

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at nl.siegmann.epublib.epub.EpubReader.<clinit>(EpubReader.java:33) #115

Open d4rKn1ght opened 7 years ago

d4rKn1ght commented 7 years ago

trying on a Simple Java program to read an epub file and display the Author (metadata):

    try {

         System.out.println("Inside Try block");

         EpubReader ereader = new EpubReader();

          Book ebook = ereader.readEpub(new FileInputStream(filepath));
          List<String> titles = ebook.getMetadata().getTitles();

          System.out.println("book title:" + (titles.isEmpty() ? "book has no title" : titles.get(0)));
 }
    catch(Exception e)  {
        System.out.println("Exception: "+ e);
    }

This throws the exception:

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at nl.siegmann.epublib.epub.EpubReader.(EpubReader.java:33) at epub_test.EPUB_TEST.main(EPUB_TEST.java:57) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory

I have imported "epublib-core-latest.jar" - and downloaded this file from: https://github.com/psiegman/epublib/epublib-core-latest.jar

Neschastje commented 6 years ago

You have to add slf4j lib to your project.