Google has added Java 11 as a second-generation runtime on App Engine, the fully managed platform-as-a-service on Google Cloud. Second-generation runtimes on App Engine allow developers to use any version, framework, library, or binary of the supported language, whereas first-generation runtimes strictly limit these.
Java 11 is currently provided in a beta stage on App Engine, giving users access to the latest long-term support version of standard Java for deploying serverless applications. The second generation App Engine runtime for Java 11 is based on the gVisor container sandbox, which helps provide secure isolation for containers. The runtime also handles security tasks such as application and operating system security patches and updates.
With the Java 11 JDK, developers can use capabilities such as advanced type inference with the var keyword and create lists or maps with immutable collections. HttpClient support enables calling of remote hosts. Developers also can also use the Java Platform Module System introduced in Java 9. However, the Java 11 runtime no longer provides a servlet-based runtime. As a result, developers will need to bundle a server with their application in the form of an executable JAR.
Also, the second generation runtime means developers can use their framework and classes of choice as well as technologies such as Spring Boot or Vert.x. Native dependencies are supported as well, as are alternative JVM languages such as Groovy, Kotlin, and Scala.
Deployment on App Engine is done using an app.yaml file, where developers specify runtime: java11
. By specifying an extra entrypoint
parameter in app.yaml
, developers can customize Java command flags. Developers can access a free trial of Google App Engine on Google Cloud. Google also this week announced second-generation runtimes for Go 1.12 (golang) and PHP 7.3.