此内容没有您所选择的语言版本。

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


10.1. Create a Main Method in the Quickstart Class

Create a new Quickstart class by following the outlined steps:
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. 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 to the Quickstart.java file:
    package com.mycompany.app;
    
    import org.infinispan.manager.DefaultCacheManager
    import org.infinispan.Cache
    
    public class Quickstart {
      public static void main(String args[]) throws Exception {
           Cache<Object, Object> cache = 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/* com.mycompany.app.Quickstart
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat