Importing and running Java samples in Eclipse

If you are using Eclipse as your IDE to run Adobe PDF Library Java sample programs, we recommend installing Eclipse Oxygen or later.

Note: Before you complete these steps, make sure that you set up your Java samples to work with Maven.

Configure the Maven package

  1. Open Eclipse and create a new workspace. If you are not prompted for a workspace, click File and then Switch Workspace and Other.

Eclipse_01

  1. Import the project as an existing Maven project.
  2. Click File and Import.

Eclipse_02

  1. After you open the Import dialog, select Maven, and then click Existing Maven Projects.

Eclipse_03

  1. Click Next.

Eclipse_04

  1. Click Browse and navigate to the directory where you have stored the Java sample programs.
  2. You will want to select Java/Sample_Source as the root directory.

Eclipse 7b

  1. Under Projects, the pom.xml file should be selected.

Eclipse 8c

  1. Click Finish. The Maven plugin connectors appear.

Eclipse_07

  1. Click Finish. You will be asked to confirm what you plan to install.

Eclipse_08

  1. Click Next. You may be asked to review your choices, and then to accept the terms of the license agreement, Keep clicking Next as needed to step through these pages. You may need to restart Eclipse as well to complete the process.

Create a Run Configuration for a Sample Program

  1. Reopen Eclipse as needed, and open the Maven samples project.

Eclipse_09

  1. Click Project and Properties.

Eclipse 21b

  1. Select the Run/Debug Settings option.

Eclipse_11

  1. Click New. Select the Java Application option.

Eclipse_12

  1. Click OK.

Eclipse_13

  1. Click the Search button that appears next to the Main class field.

Eclipse_14

  1. The classes define all the samples available in the package. Click whatever sample program you want to launch.

Eclipse_15

  1. Click the Arguments tab.
  2. Copy and paste this text as a VM argument in the VM Arguments tab.

-Djava.library.path=target/lib

Eclipse_16

  1. Click the Environment tab. Adding these environment variables only applies to Adobe PDF Library 15. If you are working with Adobe PDF Library 18, skip to step 14.

Eclipse_17

  1. Click New.  Add these environment variables:

Windows

DLE_INSTALL_LOCATION=target\lib
PATH=target\lib

UNIX

DLE_INSTALL_LOCATION=target/lib
LD_LIBRARY_PATH=target/lib

Mac

DLE_INSTALL_LOCATION=target/lib
DYLD_LIBRARY_PATH=target/lib

  1. For Windows, the add screen will look like this:

Eclipse_18

  1. Click OK.

Eclipse_19

  1. Click OK

Eclipse_20

  1. Click Apply.
  2. From here, click Run to run the sample program.