In this tutorial, you will learn how to successfully run the LuciadFusion Platform and the samples from IntelliJ IDEA.

Prerequisites for the IDE integration

In the project configuration procedure, it is assumed that you already installed the following software:

Creating a LuciadFusion development project in IntelliJ

  1. Start IntelliJ and click Open from the Welcome screen.

  2. Browse to the root directory of your LuciadFusion installation, select it, and click OK.

    IntelliJ opens the directory as an IntelliJ Java project.

To continue the project setup:

  1. Go to File > Project Structure > Project.

  2. Select the installed JDK from the SDK drop-down menu.

    ij project setup

    If your JDK is not in the SDK dropdown menu, you can add it. Click Add SDK from the dropdown menu, locate the JDK in your file system, and click OK.

  3. Still in the Project window, change your project Language level to Java 8 at least. This setting defines the minimum Java version that your applications require to run.

  4. Select a directory for the Compiler output. If you click the folder icon in the Compiler output field, you can create an output directory in the Select Path window.

  5. Click Apply > OK to close the Project Structure window.

IntelliJ sets up your project, and starts indexing all the project files. This may take a few minutes but there is no need to wait. You can continue with the configuration of your project while IntelliJ continues indexing. You can look at the structure of your new project in the project navigation pane on the left.

At some point, IntelliJ may notify you that it detected a Web framework, and offer you the option to configure that framework. Click the Configure link, and de-select the framework in the Setup Frameworks dialog. Configuring the framework setup to include the framework may result in a broken project.

Completing the project configuration

Before you can run the LuciadFusion Platform or the samples, you need to make sure that all project dependencies are in place, such as the LuciadFusion license file and the project resources. It is also strongly recommended to enable annotation processing in your project. LuciadFusion uses annotations to register services with a registry, and provide instant application services.

  1. Right-click the LuciadFusion_<version>\samples\src directory, and select Mark directory as > Sources Root.

    ij samplesrc root
  2. From the main menu, go to File > Project Structure > Modules > Dependencies to add required files and directories.

  3. Click the + icon, and select the JARs or directories…​ option. In the next dialog, select one of the following files and directories, and click OK:

    • Development license file development.jar. This file typically resides in the licenses folder.

    • lib directory

    • lib/platform directory

    • samples/lib/thirdparty directory. This directory contains all the third-party libraries used in the samples. See the prerequisites page for a full list.

    • config directory

    • samples/resources directory

      In the Choose Categories of Selected Files dialog, select Classes, and click OK. Repeat this step until you have added each file and directory in the list.

      ij license dep
      ij dep done
  4. Click Apply > OK to close the Project Structure window.

  5. Go to File > Settings > Build, Execution, Deployment > Annotation Processors, and select the Enable Annotation processing check box.

    ij annotations on

    Click OK to finish the project configuration.

    If you are running IntelliJ on MacOS, you need to go to IntelliJ IDEA > Preferences > Build, Execution, Deployment > Compiler > Annotation Processors.

Running the LuciadFusion Platform and the samples from run configurations

Luciad strongly recommends specifying a number of Virtual Machine (VM) options before running the LuciadFusion Platform Application or the samples. They will ensure that your code runs smoothly, and performs well. You can specify the VM options in project run configurations.

Running the LuciadFusion Platform Application

To set up a run configuration for the server in the LuciadFusion Platform Application:

  1. In the project navigation pane on the left, go to LuciadFusion_<version>\lib\platform\lcd_fusionplatform.jar\com\luciad\fusion\platform\TLfnFusionPlatformApplication.

  2. Right-click TLfnFusionPlatformApplication, and select More Run/Debug > Modify Run Configuration from the options menu.

  3. . In the Build and run section, select the appropriate JDK.

  4. In the Modify options drop-down menu, select Add VM options.

  5. Copy the VM options below into the VM options field.

    -Dspring.profiles.active=fusion.single,fusion.development -Xmx4g -Xss8m -XX:SoftRefLRUPolicyMSPerMB=0
  6. In the Shorten command line field, select the JAR Manifest option.

    ij platformapp options
  7. Click Apply > OK. From now on, your LuciadFusion Platform Application uses the specified VM options when you run this configuration.

Running the samples

To set up a run configuration for samples in the samples/src directory:

  1. Go to Run > Edit Configurations…​

  2. In the Run/Debug Configurations window, click the + Add New Configuration…​ icon over the left-hand pane, and select Application from the drop-down menu.

  3. In the Build and run section, select the appropriate JDK.

  4. In the Modify options drop-down menu, select Add VM options

  5. Copy the VM options from Running the samples with an IDE into the VM options field.

  6. Enter an appropriate main class for one of the map samples in the Main class field, samples.lightspeed.shapes.MainPanel, for instance.

  7. Click Apply > OK, and click OK again to close the Run/Debug Configurations window.
    From now on, you can use this run configuration to run samples with the specified VM options.

Integrating the LuciadFusion Javadoc into your project

IntelliJ can show you the Javadoc for a LuciadFusion API code element when you select the code element and press Ctrl+Q. To activate this Quick Documentation feature for the LuciadFusion Javadoc:

  1. From the main menu, go to File > Project Structure > Modules > Dependencies.

  2. Right-click the LuciadFusion_<version>\lib entry, and select Edit…​ from the context menu.

    ij javadoc
  3. In the Configure Module Library window, click the + Add button.

  4. Navigate to the docs/reference/LuciadFusion folder, select it, and click OK.

  5. Click OK twice more to close the Configure Module library window, and the Project Structure window.

You are done! You can now start developing.

If IntelliJ is still busy indexing the project files you will have to wait until it finishes before you are able to run the samples.