---
title: JAR task for jobs
description: Configure a JAR task in a Lakeflow Job to deploy Scala or Java code compiled into a JAR.
canonical_url: https://docs.databricks.com/aws/en/jobs/tasks/jar
---

# JAR task for jobs

Use the JAR task to deploy Scala or Java code compiled into a JAR (Java ARchive). Before you create a JAR task, see [Create a Databricks compatible JAR](https://docs.databricks.com/aws/en/jobs/tasks/jar-create.md) for build requirements and limitations.

## Requirements

* Choose a compute configuration that supports your workload.
* Upload your JAR file to a location or Maven repository compatible with your compute. See [JAR library support](https://docs.databricks.com/aws/en/libraries/index.md#jar-library-support).
* **For standard access mode:** An admin must add Maven coordinates and JAR paths to an [allowlist](https://docs.databricks.com/aws/en/data-governance/unity-catalog/manage-privileges/allowlist.md). See [standard access limitations](https://docs.databricks.com/aws/en/compute/standard-limitations.md#language).

## Configure a JAR task

Add a `JAR` task from the **Tasks** tab in the Jobs UI by doing the following:

1. Click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) **Add task**.

2. Enter a name into the **Task name** field.

3. In the **Type** drop-down menu, select `JAR`.

4. Specify the **Main class**.
   * This is the full name of the class containing the main method to be executed. This class must be included in a JAR configured as a **Dependent library**.

5. Click **Compute** to select or configure compute. Choose a classic or serverless compute.

6. Configure your environment and add dependencies:
   * For classic compute, click ![Plus icon.](https://docs.databricks.com/aws/en/images/product-icons/PlusIcon.svg) **Add** under **Dependent libraries**. The **Add dependent library** dialog appears.
     * You can select an existing JAR file or upload a new JAR file.
     * Not all locations support JAR files.
     * Not all compute configurations support JAR files in all supported locations.
     * Each **Library Source** has a different flow for selecting or uploading a JAR file. See [Install libraries](https://docs.databricks.com/aws/en/libraries/index.md).

   * For serverless compute, choose an environment then click ![Pencil icon.](https://docs.databricks.com/aws/en/images/product-icons/PencilIcon.svg) edit to configure it.
     * You must select **4** or higher for the **Environment version**.
     * Add your JAR file.
     * Add any other dependencies that you have. Don't include Spark dependencies, because these are already provided in the environment by Databricks Connect. For more information on dependencies in JARs, see [Create a Databricks compatible JAR](https://docs.databricks.com/aws/en/jobs/tasks/jar-create.md).

7. (Optional) Configure **Parameters** as a list of strings passed as arguments to the main class. See [Configure task parameters](https://docs.databricks.com/aws/en/jobs/task-parameters.md).

8. (Optional) To configure retries, run-duration or streaming-backlog thresholds, or notifications, see [ Advanced task settings](https://docs.databricks.com/aws/en/jobs/configure-task.md#advanced).

9. Click **Save task**.

To edit, clone, disable, or delete this task, see [Configure and edit tasks in Lakeflow Jobs](https://docs.databricks.com/aws/en/jobs/configure-task.md).

## <a id="additional-resources" />Additional resources

* [JAR task](https://docs.databricks.com/aws/en/dev-tools/bundles/job-task-types.md#jar): Define a JAR task as code with Declarative Automation Bundles.
* [Create a Databricks compatible JAR](https://docs.databricks.com/aws/en/jobs/tasks/jar-create.md): Create a Databricks compatible JAR.
* [Install libraries](https://docs.databricks.com/aws/en/libraries/index.md): Manage dependent libraries.
