Epublib is a java library for reading/writing epub files. It comes with both a viewer and a command-line tool. It’s intended use is both as part of a larger java application and as a command-line tool.
The api is designed to be as simple as possible, while at the same time making complex things possible too.
// read epub
EpubReader epubReader = new EpubReader();
Book book = epubReader.readEpub(new FileInputStream("mybook.epub"));
// set title
book.getMetadata().setTitles(new ArrayList<String>() {{ add("an awesome book");}});
// write epub
EpubWriter epubWriter = new EpubWriter();
epubWriter.write(book, new FileOutputStream("mynewbook.epub"));