Setting Up the Product Examples

The GemFire examples are included in the distribution that contains your GemFire software. Set up your environment to run these examples as described in this section.

After you download Pivotal GemFire, you can run the examples to explore GemFire's feature set and evaluate the software.


  1. Locate the SampleCode directory in your VMware Pivotal GemFire product installation. (See Table 1.)
  2. Add the example class directories to your CLASSPATH.
    • tutorial/classes
    • helloworld/classes
    • quickstart/classes
    • examples/dist/classes

    In the example class directories, replace <InstallDirectory> with the directory that contains your GemFire product installation. For example:

    • Unix Bourne and Korn shells (sh, ksh, bash).
      export CLASSPATH
    • Windows
      set CLASSPATH=%CLASSPATH%;%GEMFIRE%\tutorial\classes;^

Examples Included with Pivotal GemFire

The following examples are included in the SampleCode directory from your GemFire product download.

Table 1. GemFire Examples
Example Example Code Location Documentation Location
Hello World

A simple demonstration of GemFire data distribution.

SampleCode/helloworld Pivotal GemFire User's Guide: Hello World Example
Pivotal GemFire Tutorial

A guided tour of Pivotal GemFire's core features.

SampleCode/tutorial Pivotal GemFire User's Guide: Pivotal GemFire Tutorial
QuickStart Examples

Demonstrates the following GemFire features:

  • Benchmark examples:
    • Peer to peer
    • Client-server
  • Cache eviction
  • Cache expiration
  • Delta propagation
  • Distributed locking
  • Fixed partitioning
  • Function execution
  • JSON
  • Management and monitoring
  • Multiple secure client
  • Overflowing data to disk
  • Partitioned data caching
  • Persisting data
  • Querying
  • Replicated caching
  • Reliable event notifications:
    • Interest registration
    • Continuous querying
    • Durable event messaging
  • Secure client
  • Server-managed caching
  • Transactions
SampleCode/quickstart Pivotal GemFire User's Guide:QuickStart Examples
Programming Examples

The following examples demonstrate how to write applications using the Pivotal GemFire Java API:

  • Cache overflow
  • Cache runner
  • Client API
  • Client/Server configurations
  • Delta propagation
  • Flash cache
  • High availability overflow
  • Partitioned persistence
  • Portable data exchange serialization (PDX)
  • System administration explorer
  • Transactions
  • WAN
  • WAN: active data

Documentation for the Programming Examples is available in the following files in the SampleCode directory of your GemFire download:

Examples guide:



(Each example subdirectory contains a README.html file with the documentaiton for that example.)

Examples Javadocs:



OSGi Examples

The following examples demonstrate how to deploy GemFire applications into an OSGi environment:

  • cacheWorker
  • cacheWorkerFragment



What to do next
Note: The Spring Data GemFire project enables developers to use the Spring Data GemFire API to write applications and configure a GemFire system. See Spring Data GemFire Code Examples.