Last Modified 2019.10.27

How to make an EPUB ebook with Eclipse

Create Static Web Project

File - New - Project

Static Web Project

Project name: MyFirstBook

Web content: OEBPS Change WebContent to OEBPS

Open Perspective Button [Optional] Change to Static Web Perspective

Finish

Create folders and files that make up EPUB

Refer to the How to make EPUB ebook and create the files in the directory structure below.

MyFirstBook (ROOT Directory)
├── mimetype
├── META-INF
│    └── container.xml 
└── OEBPS 
    ├── content.opf
    ├── toc.ncx
    ├── css
    |    └── epub.css
    ├── images
    |    └── cover.jpg
    └── xhtml
         ├── cover.xhtml
         ├── preface.xhtml
         ├── ch01.xhtml
         └── ch02.xhtml

Configure Eclipse to edit the content.opf in an XML editor

Window - Preferences

File associations - Add

Input *.opf Input *.opf

Finish

Configure Eclipse to edit the toc.ncx in an XML editor

Window - Preferences

File associations - Add

Input *.ncx Input *.ncx

Finish

Create script to create and check the EPUB file

Create makebook file Create makebook file in the root directory

If your operating system is Linux, create a makebook file. -Modify the last line of epubcheck.jar and MyFirstBook.epub file paths to suit your own environment-- If your operating system is Windows, create a makebook.bat.

makebook
#!/bin/sh

rm MyFirstBook.epub

zip -0Xq MyFirstBook.epub mimetype

zip -Xr9Dq MyFirstBook.epub META-INF OEBPS

java -jar /home/kim/epubcheck-4.2.2/epubcheck.jar /home/kim/EPUB/MyFirstBook/MyFirstBook.epub

Set up the makebook to run on a Linux system.

makebook Properties

Permissions: Owner-Execute

External Tools Configurations

Select External Tools Configuration...

Exteranl Tools Configurations Start

Select a program: makebook

Choose Location Finish

Folder Selection

External Tools Configurations End

Run MyFirstBook

Run MyFirstBook

See MyFirstBook Result.

Create script to create and check EPUB files in Windows

Create a makebook.bat file in the root directory. -Modify the last line of epubcheck.jar and MyFirstBook.epub file paths to suit your own environment--

makebook.bat
del MyFirstBook.epub

zip -0Xq MyFirstBook.epub mimetype

zip -Xr9Dq MyFirstBook.epub META-INF OEBPS

java -jar C:/epubcheck-4.1.1/epubcheck.jar C:/EPUB/MyFirstBook/MyFirstBook.epub

Refer to the Linux configuration above and set as follows.

MyFirstBook Result

EPUBCheck completed

Related Articles