All samples are available with their source code and can be modified. To edit and compile the samples, it is recommended to use an IDE such as Eclipse , IntelliJ IDEA or Netbeans.

Before you can compile and run the samples from your IDE, you need to set up the IDE development project in a specific way.

Detailed instructions are available for the most commonly used IDEs:

Compiling the samples with an IDE

The source code of the samples is located in the samples/src directory. To compile the samples from the IDE, create a project for your IDE in the LuciadLightspeed installation directory. Make sure to complete these project setup steps:

Complete the classpath.

Add the following jars and directories to the classpath:

  • All jar files in the lib directory

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

  • The development.jar file that you have installed in the licenses directory

  • The config directory, if available

  • The samples/resources directory, if available

Exclude JARs from the classpath.

Do not include any other jar files in the classpath. More specifically, never include the following files:

  • Any jar file in the samples/lib directory (with the exception of samples/lib/thirdparty)

  • Any jar file in the build directory or any of its subdirectories

  • Any jar file in the distrib directory or any of its subdirectories

Activate annotation processing.

The samples use annotations to look up data format services. Hence, the sample code must be compiled with annotation processing enabled. All major IDE implementations support annotation processing, but you may need to activate it in your compilation settings. If your IDE requires you to explicitly declare annotation processors, point it to lcd_annotations.jar. For more information about activating and troubleshooting annotation processing in an IDE, see the Fixing service registry errors article.

the LuciadLightspeed distribution contains an example Ant script that demonstrates how to compile and package the samples. It is located in the build/samples directory.

Running the samples with an IDE

To run the samples from the IDE, define a sample run configuration:

Set the main class.

You can run all sample classes that have valid main methods. Most of these classes are called MainPanel.

If you have Lucy and want to run the samples with Lucy, you should specify com.luciad.lucy.TLcyMain as main class.

Set the VM options.

Make sure to set the following VM options:

VM option Comments

-Xmx1500m

Defines the maximum amount of memory. This value targets 64-bit VMs. You can adapt the setting to your needs. See the Oracle documentation for more information on Java memory settings.

-Djava.net.useSystemProxies=true

Tells the proxy selector to use the system settings for proxy servers. Those system-wide proxy settings ensure that they have to be checked only once on a given system.

-Dsun.awt.noerasebackground=true

Improves paint performance and reduces flickering for AWT components.

-Dsun.java2d.opengl=false

Disables the OpenGL-accelerated painting pipeline that comes with the JDK.

-Dswing.aatext=true

Enables text anti-aliasing in Swing components.

-Dsun.java2d.d3d=false

Setting sun.java2d.d3d to false is a work-around for a known bug in Java.

-Djava.library.path=

Defines the location of native libraries. It must be set to an empty string to prevent that a platform-dependent default value is used. That default value may refer to incompatible versions of native libraries on your system, and cause conflicts during library loading.

--add-modules javafx.controls,javafx.web,javafx.swing,javafx.fxml

Allows you to run JavaFX samples

--module-path /path/to/your/javafx-sdk/lib

Set the path to your JavaFX library to run JavaFX samples

--add-exports java.desktop/sun.awt.image=ALL-UNNAMED
--add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED
--add-exports java.desktop/com.apple.eawt=ALL-UNNAMED

Allows you to use the JIDE, JAI and EAWT third party libraries

--add-opens java.base/java.lang=ALL-UNNAMED

Needed for the Ehcache third party library to function properly. If not set, Ehcache cannot accurately calculate the size of some objects, which can cause inefficient cache usage. Ehcache is used in the WCS, WMS and WMTS server components.

Logging is optional. See the Logging documentation for more information.