Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

What is a KJAR?

March 14, 2018
David Laffranchi
Related topics:
Java
Related products:
Developer Tools

Share:

    Red Hat JBoss® BPM Suite and Red Hat Decision Manager (formerly Red Hat JBoss BRMS) both use an artifact packaging known as a "KJAR", or knowledge artifact, since version 6. What is this file type? What separates it from a standard JAR file?

    The basic summary

    In very few words, a KJAR is a standard JAR file that has some extra files included. A KJAR keeps the same .jar extension as a JAR file, because its basic file structure is identical to that of a JAR.

    Why the difference?

    A JAR ("Java archive") file is meant to run Java code of any kind, with nearly limitless resources and assets potentially being included as part of the package. To quote the JAR standard, "A JAR file is essentially a zip file that contains an optional META-INF directory." 1 By contrast, a KJAR ("Knowledge artifact") is specifically targeted for rules and processes which tend to be notated in XML or plain text. There may or may not be any further resources or assets contained within a knowledge artifact. The contents of a KJAR are still intended to compile into Java bytecode, but the specific focus on rules and processes allows them to configure and optimize their contents while still conforming to the standard JAR file structure.

    What differences are there?

    A KJAR must, at least, contain the file META-INF/kmodule.xml. This file is used to describe the KJAR structure and define some KIE-specific artifacts. The v6 specification for this file can be found here, and an example for v6 can be found here.

    The following items are also different between JARs and KJARs:

    • Maven-based
      • JAR: Does not need not be built according to any specific folder structure, as long as a META-INF directory is present at the top level
      • KJAR: Conforms to the Maven Standard Directory Layout
    • Extra files
      • JAR: No specific files are required to be present
      • KJAR: Must contain a META-INF/kmodule.xml file, which in turn must contain at least a correctly formatted <kmodule> XML tag
    • Pre-compiled asset cache
      • JAR: Any code which is to be pre-compiled into bytecode is the responsibility of the build service which generates the JAR.
      • KJAR: Uses the KIE Maven plugin during build time, which automatically pre-compiles some rule and process assets into a cache (META-INF/<kie-base-name>/kbase.cache). (This cache is not complete, but can improve performance when loading rules/processes.) If the cache is not created, all assets will be built at runtime.
    • Deployment Descriptor (since v6.1)
      • JAR: No specific configurations or deployment types are specified, though various other frameworks or standards (such as Java EE) may create their own standards.
      • KJAR: If the file META-INF/kie-deployment-descriptor.xml exists, it is used automatically to determine various properties for executing rules and/or processes such as runtime strategy, event listeners, work item handlers, and more. 2

    What remains the same?

    Nearly everything about a KJAR is really a targeted addition to a JAR file, so you can count on KJARs being almost entirely the same as JAR files. You can still use a MANIFEST.MF file to define package info, you can still use a beans.xml file to have CDI pick up classes, and you can still use popular files like logback.xml or log4j.xml for use with popular Java logging frameworks.

    How is a KJAR made?

    The primary difference between building a KJAR and building a standard JAR is that the KJAR has a <packaging>kjar</packaging> entry in its pom.xml and also contains the necessary <plugin> for kie-maven-plugin in that same file. 3

    What happens if I generate a JAR instead of a KJAR?

    Officially, use of the KIE Maven plugin ensures that artifact resources are validated and pre-compiled, so use of that plugin is recommended at all times. However, if the rules/processes inside a KJAR are valid there are unlikely to be any execution problems whether they are running from a JAR or a KJAR. No kbase.cache would be created without the KIE Maven plugin 4, so it's possible that users would encounter worse performance when attempting to run rules/processes from a JAR instead of a KJAR.

    Footnotes:

    1) JAR File Specification - https://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html

    2) Deployment Descriptors - https://access.redhat.com/documentation/en-us/red_hat_jboss_bpm_suite/6.4/html/administration_and_configuration_guide/chap_business_central_configuration#idm139940729511264

    3) How to build a kjar from Maven command for BRMS/BPM Suite 6? - https://access.redhat.com/solutions/892893

    4) Is it possible to load kbase.cache file directly to save time for loading KieBase in Drools 6 ? - https://access.redhat.com/solutions/1297523

    Last updated: March 19, 2024

    Recent Posts

    • AI meets containers: My first step into Podman AI Lab

    • Live migrating VMs with OpenShift Virtualization

    • Storage considerations for OpenShift Virtualization

    • Upgrade from OpenShift Service Mesh 2.6 to 3.0 with Kiali

    • EE Builder with Ansible Automation Platform on OpenShift

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue