Chapter 10. Run Red Hat JBoss Data Grid in Library Mode (Single-Node Setup)


10.1. Run the Quickstart Class

Prerequisites

These quickstarts use the Infinispan quickstarts located at https://github.com/infinispan/infinispan-quickstart. The following procedure uses the infinispan-quickstart/embedded-cache quickstart.

Procedure 10.1. Run the Quickstart Class

  1. Open the Quickstart.java File

    Open the file called Quickstart.java in the infinispan-quickstart/embedded-cache.
  2. Add the Quickstart Class

    Examining the Quickstart.java file we can see that this class creates a DefaultCacheManager and then obtains a local reference to the default cache, as no cache name is specified:
    package org.infinispan.quickstart.embeddedcache;
    
    import org.infinispan.Cache;
    import org.infinispan.manager.DefaultCacheManager;
    
    public class Quickstart {
    
       public static void main(String args[]) throws Exception {
          Cache<Object, Object> c = new DefaultCacheManager().getCache();
       }
    
    }
    Copy to Clipboard Toggle word wrap
  3. Copy Dependencies and Compile Java Classes

    Use the following command to copy all project dependencies to a directory and compile the Java classes from your project:
    $ mvn clean compile dependency:copy-dependencies -DstripVersion
    Copy to Clipboard Toggle word wrap
  4. Run the Main Method

    Use the following command to run the main method:
    $ java -cp target/classes/:target/dependency/* package org.infinispan.quickstart.embeddedcache.Quickstart
    Copy to Clipboard Toggle word wrap
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat