Java 11 Runtime Environment

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 app.yaml file:

runtime: java11

Before you begin

  1. Download the latest version of the Cloud SDK or update your Cloud SDK to the current version:

    gcloud components update
  2. To deploy using Maven, you will need to add the App Engine Maven Plugin to your pom.xml file:


    Other options for deploying include using the gcloud app deploy command or the App Engine Gradle plugin.

  3. Follow the instructions for your application framework to configure the build of an executable JAR file.

Framework compatibility

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.

There are hello world samples using popular Java web frameworks on the Google Cloud GitHub repository:

You are not limited to these frameworks and are encouraged to try your preferred one, like Grails, Blade, Play!, Vaadin or jHipster.

Deploy Maven source projects to the Java 11 runtime

You can deploy your Maven project as source code and have it built and deployed using App Engine Buildpacks.

To deploy a Maven project project as source code, go to your project's top level directory and type:

gcloud app deploy pom.xml

Build and deploy logs will be streamed, and you can see the detailed logs in the Cloud Build history section in the Cloud Console.

Using GraalVM executables

The App Engine standard Java 11 runtime supports GraalVM native image executables. Once you have compiled your Java 11 app into a GraalVM native image, you can use the entrypoint setting in your app.yaml file to point to the executable.

For example, an executable with the filename myexecutable could have the followingapp.yaml configuration file:

runtime: java11
entrypoint: ./myexecutable

Java version

The Java 11 runtime environment uses the latest stable release of Java 11. App Engine automatically updates to new minor revisions, 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.

The runtime's Open JDK environment

App Engine runs Java 11 apps in a container secured by gVisor on an up-to-date Ubuntu 18.04 Linux distribution and its supported openjdk-11-jdk package. App Engine maintains the base image and updates the OpenJDK 11 package, without requiring you to redeploy your app.

Your deployed app is located in the runtime's /workspace directory. It is also accessible through a symbolic link at /srv.


For more information on declaring and managing dependencies, see Specifying dependencies.

Application startup

Frameworks such as Spring Boot, Micronaut, Ktor build an executable uber JAR 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 app.yaml file.
  • Contain a Main-Class entry in its META-INF/MANIFEST.MF metadata file.
  • Optionally, contain a Class-Path entry 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.

Be sure to use the PORT environment variable

If you see the warnings about port 8080 and NGINX in your app log files, your app's web server is listening on the default port 8080. This prevents App Engine from using its NGINX layer to compress HTTP responses. We recommend that you configure your web server respond to HTTP requests on the port specified by the PORT environment variable, typically 8081. For example:

 * Copyright 2019 Google LLC
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.

package com.example.appengine;


public class Main {

  public static void main(String[] args) throws IOException {
    // Create an instance of HttpServer bound to port defined by the 
    // PORT environment variable when present, otherwise on 8080.
    int port = Integer.parseInt(System.getenv().getOrDefault("PORT", "8080"));
    HttpServer server = HttpServer.create(new InetSocketAddress(port), 0);

    // Set root URI path.
    server.createContext("/", (var t) -> {
      byte[] response = "Hello World!".getBytes();
      t.sendResponseHeaders(200, response.length);
      try (OutputStream os = t.getResponseBody()) {

    // Create a second URI path.
    server.createContext("/foo", (var t) -> {
      byte[] response = "Foo!".getBytes();
      t.sendResponseHeaders(200, response.length);
      try (OutputStream os = t.getResponseBody()) {


Compatibility with previous Java versions

Users can access the following features from previous versions of Java:

  • Advanced type inference with the var keyword.
  • 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.

Environment variables

The following environment variables are set by the runtime:

Environment variable Description
GAE_APPLICATION The ID of your App Engine application. This ID is prefixed with 'region code~' such as 'e~' for applications deployed in Europe.
GAE_DEPLOYMENT_ID The ID of the current deployment.
GAE_ENV The App Engine environment. Set to standard.
GAE_INSTANCE The ID of the instance on which your service is currently running.
GAE_MEMORY_MB The amount of memory available to the application process, in MB.
GAE_RUNTIME The runtime specified in your app.yaml file.
GAE_SERVICE The service name specified in your app.yaml file. If no service name is specified, it is set to default.
GAE_VERSION The current version label of your service.
GOOGLE_CLOUD_PROJECT The Cloud project ID associated with your application.
PORT The port that receives HTTP requests.

You can define additional environment variables in your app.yaml file, but the above values cannot be overridden.

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 the standard X-Forwarded-For header. Applications that require this information should configure their web framework to trust the proxy.

Filesystem access

The runtime includes a writable /tmp directory, with all other directories having read-only access. Writing to /tmp takes up system memory.

Metadata server

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:

  • http://metadata

Requests sent to the metadata server must include the request header Metadata-Flavor: Google. This header indicates that the request was sent with the intention of retrieving metadata values.

The following table lists the endpoints where you can make HTTP requests for specific metadata:

Metadata endpoint Description
/computeMetadata/v1/project/numeric-project-id The project number assigned to your project.
/computeMetadata/v1/project/project-id The project ID assigned to your project.
/computeMetadata/v1/instance/zone The zone the instance is running in.
/computeMetadata/v1/instance/service-accounts/default/email The default service account email assigned to your project.
/computeMetadata/v1/instance/service-accounts/default/ Lists all the default service accounts for your project.
/computeMetadata/v1/instance/service-accounts/default/scopes Lists all the supported scopes for the default service accounts.
/computeMetadata/v1/instance/service-accounts/default/token 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