7.2. Create a Main Method in the Quickstart Class


Create a new Quickstart class by following the outlined steps:

Procedure 7.1. Create a Main Method in the Quickstart Class

  1. Create the Quickstart.java File

    Create a file called Quickstart.java at your project's location.
  2. Add the Quickstart Class

    Add the following class and method:
    import org.infinispan.manager.DefaultCacheManager
    import org.infinispan.Cache
    
    package com.mycompany.app;
    public class Quickstart {
      public static void main(String args[]) throws Exception {
           Cache<Object, Object> c = new DefaultCacheManager().getCache();
        }
     }
    
  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 our project:
    $ mvn clean compile dependency:copy-dependencies -DstripVersion
    
  4. Run the Main Method

    Use the following command to run the main method:
    $ java -cp target/classes/:target/dependency/* com.mycompany.app.Quickstart
    
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.

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.

© 2024 Red Hat, Inc.