We recommend that you use Apache Maven or an IDE like Eclipse to compile the samples for Datalogics PDF Java Toolkit. If you are more comfortable at a command line, you can certainly compile and run samples there, the command is more complex. Keep in mind that these are sample commands and that you will need to update them depending on the version of Datalogics PDF Java Toolkit that you are working with.
Download the required Third party libraries
If you are trying to compile and run samples from the command line without using Maven, you need to download the third party libraries that Datalogics PDF Java Toolkit depends on, such as BouncyCastle or Xerces-J. In addition to adding the components of PDF Java Toolkit to the classpath, you will need to include them in the classpath argument used whenever compiling or running the samples in the following commands as well. The third party libraries are intentionally left out of the example commands here to make them more readable.
Setting up the PATH System Variable
You might need to manually add Java to your PATH environment variable in order to run it from the command line. If you receive an error like
'java' is not recognized as an internal command or external command
then you will need to modify your PATH environment variable. This page provides an easy guide to follow to add Java to your PATH environment variable.
Compile IoUtils package
The samples for Datalogics PDF Java Toolkit all rely on a few utility classes that can be found in the IoUtils package. Before compiling any of the samples, you need to compile this package first.
Assuming that you are in the samples directory of Datalogics PDF Java Toolkit download, here is the command to compile the IoUtils package on Windows:
javac -classpath ..\repo\com\adobe\pdfjt\pdfjt\3.3.1\pdfjt-3.3.1.jar:..\repo\com\datalogics\pdf\talkeetna\5.0.4\talkeetna-5.0.4.jar src\main\java\com\datalogics\pdf\samples\util\*.java
Compile the HelloWorld Sample
Once the IoUtils package has been compiled, you can compile any of the samples for Datalogics PDF Java Toolkit. As an example here is the command that could be used to compile the HelloWorld sample using Datalogics PDF Java Toolkit 6.3.1:
javac -classpath ..\repo\com\adobe\pdfjt\pdfjt\3.3.1\pdfjt-3.3.1.jar;..\repo\com\datalogics\pdf\talkeetna\5.0.4\talkeetna-5.0.4.jar src\main\java\com\datalogics\pdf\samples\creation\HelloWorld.java
After the HelloWorld sample has been compiled, you can run it with the following command:
java -classpath ../repo/com/adobe/pdfjt/pdfjt/3.3.1/pdfjt-3.3.1.jar:../repo/com/datalogics/pdf/talkeetna/5.0.4/talkeetna-5.0.4.jar com.datalogics.pdf.samples.creation.HelloWorld
Now that you have compiled and run the HelloWorld sample, you can apply these same steps to any of the other samples.