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
Open the Quickstart.java File
Open the file calledQuickstart.java
in theinfinispan-quickstart/embedded-cache
.Add the Quickstart Class
Examining theQuickstart.java
file we can see that this class creates aDefaultCacheManager
and then obtains a local reference to thedefault
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 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
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