A
A
alexrett2014-06-29 22:58:17
Java
alexrett, 2014-06-29 22:58:17

PdfFormFiller.java does not compile, what am I doing wrong?

I can’t compile the class for filling out PDF forms https://github.com/nkitsul/pdfformfiller2
I do everything like this:

mkdir PdfFormFiller
cd PdfFormFiller/
git clone https://github.com/nkitsul/pdfformfiller2.git .
cd lib/
wget https://github.com/itext/itextpdf/releases/download/5.5.0/itext-5.5.0.zip
unzip itext-5.5.0.zip 
cd ..
mkdir bin
javac -cp lib/itextpdf-5.5.0.jar PdfFormFiller.java -d bin/
java -cp ./bin PdfFormFiller.PdfFormFiller

And immediately I get a list of errors:
Exception in thread "main" java.lang.NoClassDefFoundError: com/itextpdf/text/DocumentException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
    at java.lang.Class.getMethod0(Class.java:2774)
    at java.lang.Class.getMethod(Class.java:1663)
    at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: com.itextpdf.text.DocumentException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 6 more

I have never worked with Java before and never built projects with it, so I'm sure I did something wrong.
Tell me what's wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SirEdvin, 2014-06-30
@SirEdvin

You compiled it correctly, but you run it incorrectly.
You need to add a lib to the run command

A
Alexander Lukyanov, 2015-10-29
@sanluck

What is the original task?
Do you need to create a printable for a web application? Is the application made in Java?
Or do you need to embed this solution somewhere or just need to create a printable?
If you have a Java application, I advise you to look at JasperReports - it can be used to create a printable form template, then data can be substituted from a request directly inside the template or from a bean passed from the application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question