All Products
Search
Document Center

MaxCompute:ADD JAR

Last Updated:Mar 25, 2026

Adds a JAR file as a resource to a MaxCompute project.

Limitations

  • External tables cannot be added as resources.

  • The maximum size of a single resource file is 2,048 MB. Resources referenced by a single SQL or MapReduce job cannot exceed 2,048 MB in total.

  • This is a CMD statement and can only be run on the MaxCompute client (odpscmd).

Syntax

add jar <local_file> [comment '<comment>'] [-f];

Parameters

Resource type

  • jar: Required. Specifies the resource type. For more information about resource types, see Resource.

Common parameters

ParameterRequiredDescription
local_fileYesLocal path of the file to add. The file name becomes the resource name, which uniquely identifies the resource in the project.
aliasNoCustom name for the resource. If not specified, the file name is used as the resource name. JAR packages and Python script files do not support this parameter.
commentNoComment for the resource.
-fNoOverwrites an existing resource if the resource name is already taken. Without -f, the command fails when a duplicate resource name exists.

Examples

Add a JAR file using its local path:

add jar /path/to/example.jar;

Add a JAR file and overwrite an existing resource with the same name:

add jar /path/to/example.jar -f;

Add a JAR file with a comment:

add jar /path/to/example.jar comment 'UDF for data parsing';

Related statements