I wrote the basic code below and saved to a file called pdf.java.
package pdf;
import java.util.*;
import java.io.*;
import com.lowagie.text.DocumentException;
import org.xhtmlrenderer.pdf.ITextRenderer;
import java.util.regex.*;
public class pdf {
public static void main(String[] args) throws IOException, DocumentException{
System.out.println("Hello World2!");
}
}
I then compiled it like this,
javac pdf.java -cp core-renderer.jar:iText-2.0.8.jar
Which seemed to work as I got a pdf.class file. I then tried to run it with the following command.
java pdf
And I got the following output,
Exception in thread "main" java.lang.NoClassDefFoundError: pdf (wrong name: pdf/pdf)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
What am I doing wrong?
Thanks in advance.