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"
Maven Build and Deployment¶
flowchart LR
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:
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