The Cloud Functions Java 11 runtime is based on Java version 11.0.6. For instructions on how to prepare your local machine for Java development, see Setting Up a Java Development Environment.
To get started with Java on Cloud Functions, see the Quickstart.
Selecting the runtime
You can select the Java 11 runtime for your function during deployment.
If you are using the
gcloud command-line tool, you can specify the runtime
by using the
--runtime parameter. The
--entry-point flag specifies the
fully qualified class name (FQN). For example:
gcloud functions deploy NAME --entry-point FQN --runtime java11 --trigger-http
For more arguments that you can specify when you are deploying, see Deploy using the gcloud tool.
If you are using the Cloud Console, you can select the runtime when you create and deploy a function. See the Cloud Console quickstart for detailed instructions.
The execution environment includes the runtime, the operating system, and a library that invokes your function.
The Java 11 runtime uses an execution environment based on Ubuntu 18.04 with Java version 11.0.6. See Cloud Functions Execution Environment for more information.
The library that invokes your function is the Java Functions Framework.
Source code structure
In order for Cloud Functions to find your function's definition, each runtime has certain structuring requirements for your source code. See Writing Cloud Functions for more information.
- Learn how to use Java frameworks that provide out-of-the-box support for writing Java Cloud Functions.
- Learn how to use popular APIs and logging frameworks to configure the logging behavior of Java Cloud Functions.
- Learn about the other JVM languages you can use to write Cloud Functions: Kotlin, Groovy, and Scala.