All Products
Search
Document Center

Function Compute:How do I configure a handler in a Java runtime?

Last Updated:Apr 01, 2026

In Function Compute, the handler is the entry point that the runtime invokes when your function is triggered. Because Java uses packages to organize classes, the handler format for Java functions differs from other runtimes and must include the package name.

Prerequisites

Before you begin, ensure that you have:

Handler format

Set the Handler parameter using the following format:

[Package name].[Class name]::[Method name]

Each part maps directly to your Java source code:

PartMaps toExample
[Package name]The package declaration at the top of your fileexample
[Class name]The public class containing the handler methodHelloFC
[Method name]The method Function Compute calls when the function runshandleRequest

For example, if your code looks like this:

package example;

public class HelloFC {
    public String handleRequest(String input, Context context) {
        // function logic
    }
}

Set the handler to example.HelloFC::handleRequest.

Configure the handler in the console

  1. Log on to the Function Compute console. In the left-side navigation pane, click Functions.

  2. In the top navigation bar, select a region. On the Functions page, click Create Function.

  3. On the Create Function page, select Event Function. In the Code section, select a Java runtime.

  4. In the Advanced Settings section, set the Handler parameter to the value matching your code structure.

    image