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

  • 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 or any of its subdirectories

  • 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

-Xmx750m

Defines the maximum amount of memory. You can adapt this setting to your needs. For more information on Java’s memory settings, please take a look at Oracle’s detailed guide .

-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.

-XX:+UseConcMarkSweepGC

Increases Java garbage collection performance (Java 1.8 only).

-XX:+CMSParallelRemarkEnabled

Increases Java garbage collection performance (Java 1.8 only).

-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

Allows you to run JavaFX samples (Java 11 or higher only)

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

Set the path to your JavaFX library to run JavaFX samples (Java 11 or higher only)

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

Setting up a Lucy-based project

This is explained in a dedicated article.