The Java 11 runtime is the software stack responsible for installing your web service's code and its dependencies and running your service.
The Java 11 runtime for App Engine in the standard environment is
declared in the
Before you begin
Download the latest version of the Cloud SDK or update your Cloud SDK to the current version:
gcloud components update
To deploy using Maven, you will need to add the App Engine Maven Plugin to your
<plugin> <groupId>com.google.cloud.tools</groupId> <artifactId>appengine-maven-plugin</artifactId> <version>2.0.0</version> </plugin>
Other options for deploying include using the
gcloud app deploycommand or the App Engine Gradle plugin.
Follow the instructions for your application framework to configure the build of an executable
With the App Engine Java 11 runtime, you can deploy executable JAR files. The runtime does not include any web-serving framework, meaning you are not limited to using servlet-based frameworks or libraries. Use your native dependencies or networking stacks such as the Netty library.
hello world samples using popular Java web frameworks on the
Google Cloud GitHub repository:
The Java 11 runtime environment uses the latest stable release of Java 11. App Engine automatically updates to new minor revisions upon deployment, but will not automatically update the major version.
For example, your application might be deployed at Java 11.0.4 and automatically updated to version Java 11.0.5 at a later deployment of the managed platform, but it will not be automatically updated to Java 12.
For more information on declaring and managing dependencies, see Specifying dependencies.
Frameworks such as Spring Boot, Micronaut, Ktor build an executable uber
by default. If your Maven or Gradle build file produces an executable Uber JAR,
the runtime starts your application by running an Uber JAR application.
Alternatively, App Engine will use the contents of the optional
entrypoint field in your
app.yaml file. For example:
runtime: java11 entrypoint: java -Xmx64m -jar YOUR-ARTIFACT.jar
Where the example YOUR-ARTIFACT.jar application jar must:
- Be in the root directory with your
- Contain a
Main-Classentry in its
- Optionally, contain a
Class-Pathentry with a list of relative paths to other dependent jars. These will upload with the application automatically.
For your app to receive HTTP requests, your entrypoint should start a web server
that listens on the port specified by the
PORT environment variable.
With a custom entrypoint, you can construct and package your application as a thin JAR file which only contains your application code and direct dependencies. When deploying your application, the App Engine plugin will only upload the files that changed, rather than the entire uber JAR package.
Compatibility with previous Java versions
Users can access the following features from previous versions of Java:
- Advanced type inference with the
- Create lists or maps easily with immutable collections.
- Call remote hosts using the graduated HttpClient.
- Use the JPMS module system.
- Use alternative JVM languages like Apache Groovy, Kotlin or Scala.
The following environment variables are set by the runtime:
||The ID of your App Engine application. This ID is prefixed with 'region code~' such as 'e~' for applications deployed in Europe.|
||The ID of the current deployment.|
||The App Engine environment. Set to
||The ID of the instance on which your service is currently running.|
||The amount of memory available to the application process, in MB.|
||The runtime specified in your
||The service name specified in your
||The current version label of your service.|
||The Cloud project ID associated with your application.|
||The port that receives HTTP requests.|
define additional environment variables in your
but the above values cannot be overridden, except for
HTTPS and forwarding proxies
App Engine terminates HTTPS connections at the load balancer and
forwards requests to your application. Some applications need to determine
the original request IP and protocol. The user's IP address is available in
X-Forwarded-For header. Applications that require this
information should configure their web framework to trust the proxy.
The runtime includes a writable
/tmp directory, with all other directories
having read-only access. Writing to
/tmp takes up system memory.
Each instance of your application can use the App Engine metadata server to query information about the instance and your project.
You can access the metadata server through the following endpoints:
The following table lists the endpoints where you can make HTTP requests for specific metadata:
||The project number assigned to your project.|
||The project ID assigned to your project.|
||The zone the instance is running in.|
||The default service account email assigned to your project.|
||Lists all the default service accounts for your project.|
||Lists all the supported scopes for the default service accounts.|
||Returns the auth token that can be used to authenticate your application to other Google Cloud APIs.|
For example, to retrieve your project ID, send a request to