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.
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 thelicenses
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 ofsamples/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 |
---|---|
|
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. |
|
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. |
|
Improves paint performance and reduces flickering for AWT components. |
|
Disables the OpenGL-accelerated painting pipeline that comes with the JDK. |
|
Enables text anti-aliasing in Swing components. |
|
Setting sun.java2d.d3d to false is a work-around for a known bug in Java. |
|
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. |
|
Allows you to run JavaFX samples |
|
Set the path to your JavaFX library to run JavaFX samples |
|
Allows you to use the JIDE, JAI and EAWT third party libraries |
|
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.
Setting up a Lucy-based project
This is explained in a dedicated article.