Importing and running Java samples in IntelliJ

Import the Maven project

We also describe how to set up IntelliJ as your IDE to run Adobe PDF Library Java sample programs.

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

  1. Open IntelliJ.

IntelliJ_01

  1. Select Import Project.
  2. Note that if you already have a project loaded in IntelliJ, your screens might look somewhat different from these shown here, but the steps will work the same way.

IntelliJ_02

  1. Browse to the Java/Sample_Source directory for your Adobe PDF Library installation.

IntelliJ 12b

  1. Click OK.  Select the option to Import project from external model, and select Maven.

IntelliJ_04

  1. Click Next.

IntelliJ 15b

  1. Don’t change the default values shown. Click Next.
  2. Under Select Maven projects to import, click select the project and click Next.
  3. Select the project SDK to use.  JDK v.1.7.0_80 is the minimum required version.  If the JDK you want to use does not appear, click the IntelliJ plus sign sign to add it. Click Next. Select the version of the JDK you have installed on your machine and that you plan to use with IntelliJ.

Generate the project sources

  1. Right click on the project name. Click Maven and Generate Sources and Update Folders.

IntelliJ_07

  1. Click the Target folder so that it appears with Sample_Source in the project view.

IntelliJ_08

  1. Set the Run Configuration defaults
  2. Click Run, and Edit Configurations.

IntelliJ_09

  1. Expand the Defaults folder to display the list of default options.

IntelliJ_10

  1. Click Application.

IntelliJ 31b

  1. Add this value as the VM options:

-Djava.library.path=target/lib

IntelliJ 32b

  1. If you are working with Adobe PDF Library 15, add the environment variables for your platform, Windows, UNIX, or Mac.  For APDFL 18, these do not apply, and you can skip to step 12. Click IntelliJ Add button next to the Environment variables field.
  2. Click IntelliJ plus sign to add a new Environment variable.  You will add two environment variables for your platform:

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

For Windows, the Environment Variables would look like this:

IntelliJ_14

  1. Leading to a Configuration Screen that looks like this:

IntelliJ 36b

  1. Click Apply, and OK.

This is how the environment variables should appear on your IntelliJ Configuration screen:

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. Run your Java sample. The default configuration settings will be saved and used automatically for any Adobe PDF Library sample Java program you run in the future using IntelliJ. After these default values are in place, you only need to select the main class when selecting a Java sample to open and run.