Skip to content

Java Runtime

This reference captures supported Java versions, JVM/runtime settings, Maven dependencies, and practical tuning choices for Azure Functions Java applications.

Supported Java Versions

timeline
    title Java runtime options for Azure Functions v4
    2014 : Java 8 (LTS)
    2018 : Java 11 (LTS)
    2021 : Java 17 (LTS)
    2023 : Java 21 (LTS)
Runtime Status Typical recommendation
Java 8 Supported Legacy workloads only
Java 11 Supported Existing enterprise baselines
Java 17 Supported (LTS) Default for new projects
Java 21 Supported (LTS) Newer language/runtime features

Core Runtime Settings

Setting Purpose Example
FUNCTIONS_WORKER_RUNTIME Select Java worker java
JAVA_HOME Java installation path on host Set automatically
JAVA_OPTS JVM arguments -Xmx512m
WEBSITE_RUN_FROM_PACKAGE Immutable package deployment 1
az functionapp config appsettings set   --name $APP_NAME   --resource-group $RG   --settings "FUNCTIONS_WORKER_RUNTIME=java" "JAVA_OPTS=-Xmx512m"
CLI element Explanation
Command(s) az functionapp config appsettings set
Key flags --name, --resource-group, --settings
Variables $APP_NAME, $RG
Expected result Azure CLI applies the configuration change; confirm the returned JSON or follow-up query shows the expected value.

Maven Build and Deployment

flowchart TD
    A[pom.xml] --> B[mvn clean package]
    B --> C[azure-functions-maven-plugin]
    C --> D[Function App deployment]

Required dependency:

<dependency>
    <groupId>com.microsoft.azure.functions</groupId>
    <artifactId>azure-functions-java-library</artifactId>
    <version>3.1.0</version>
</dependency>

Recommended plugin:

<plugin>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-functions-maven-plugin</artifactId>
</plugin>

Common commands:

mvn clean package
mvn azure-functions:deploy

Project Layout (Maven)

project-root/
├── src/
│   └── main/
│       └── java/
│           └── com/example/
│               ├── Function.java
│               └── ...
├── host.json
├── local.settings.json
└── pom.xml

Runtime Selection in Azure CLI

az functionapp create   --name $APP_NAME   --resource-group $RG   --storage-account $STORAGE_NAME   --plan $PLAN_NAME   --runtime java   --runtime-version 17   --functions-version 4   --os-type linux
CLI element Explanation
Command(s) az functionapp create
Key flags --name, --resource-group, --storage-account, --plan, --runtime, --runtime-version, --functions-version, --os-type
Variables $APP_NAME, $RG, $STORAGE_NAME, $PLAN_NAME
Expected result Azure CLI returns provisioning details; confirm the resource name and successful provisioning state before continuing.

See Also

Sources