All Products
Search
Document Center

MaxCompute:Package, upload, and register

Last Updated:Mar 26, 2026

After you develop and debug a Java program in IntelliJ IDEA, package it into a JAR file, upload it to your MaxCompute project as a resource, and register it as a user-defined function (UDF). MaxCompute Studio lets you do all three steps from a single dialog.

Prerequisites

Before you begin, make sure you have a Java program that is developed and debugged. For more information, see Develop a UDF, Develop a MapReduce program, or Develop Graph programs.

Package, upload, and register in one step

MaxCompute Studio packages a JAR file, uploads it to your MaxCompute project, and registers a UDF in a single workflow from within IntelliJ IDEA. We recommend that you use this method to perform these operations.

  1. In the left-side navigation pane of IntelliJ IDEA, click Project. Choose src > main > java, right-click the Java program you compiled, and select Deploy to server....

  2. In the Package a jar, submit resource and register function dialog box, configure the following parameters.

    打包

    Parameter Description
    MaxCompute project The MaxCompute project to which the Java program belongs. This field is filled in automatically.
    Resource file The local directory where the JAR file is stored.
    Resource name The name to use when uploading the JAR file to the MaxCompute project.
    Resource comment (Optional) A comment for the resource.
    Extra resources Additional resource files the UDF depends on. Select files from the resource list. To select multiple files, hold Ctrl and click each file. Only resources already added to the MaxCompute project appear in this list. For instructions on adding resources, see the "Add resources" section in Manage resources in a visualized manner.
    Main class The UDF class defined in your Java program.
    Function name The name of the UDF as it will appear in MaxCompute. Use this name when calling the UDF in SQL statements.
    Force update if already exists If you select this option, the UDF or resource that you create overwrites the existing UDF or resource that has the same name in your MaxCompute project.
  3. Click OK. The dialog closes and the UDF is registered. You can now call it in SQL statements.

Manage each step separately

Use this approach when you need more control — for example, to use a pre-built JAR, to upload resources independently, or to integrate with an external build pipeline.

  1. Package the Java program into a JAR file. For more information, see Generate a JAR file.

  2. Upload the JAR file to MaxCompute. For more information, see the "Add resources" section in Manage resources in a visualized manner.

  3. Create a MaxCompute UDF. For more information, see the "Create a function" section in Register a UDF.

Call the UDF after registration

After you register a Java UDF, call it in MaxCompute SQL:

  • Within the same project: Call the UDF the same way you call a built-in function.

  • Across projects: To call a UDF from Project B in Project A, use the following SQL statement:

    SELECT B:<udf_name>(<arg0>, <arg1>) FROM <table_name>;

    For more information about cross-project resource access, see Cross-project resource access based on packages.

References