Java 11: A Runtime Added by Google App Engine

Java 11

Recently it was announced that Google has created Java 11 to be a second-generation runtime for its App Engine. Hence, the App Engine serves as a fully managed platform-as-a-service on the Google Cloud.

A Second-Generation runtimes allows developers on App Engine to use any version, library, binary, or framework of the supported language. On the other hand, the first-generation runtimes does not allow these facilities. 

With the help of Java JDK, the developers can use the features like improved interface; which uses var keyword,create maps and lists with irreversible collection. 

Developers can also use the Module System which was first introduced in java 9.  This resulted in the need of a server along with their application as an executable JAR.

The second-generation runtime allows the developers to access any framework or classes they choose.

They can also use the technologies like Spring Boot or Vertx.Native and languages like Kotlin,Scala and Groovy.

Launching Java 11 on App Engine is done by using an app.yaml file, where the runtime: java11 is specified by the developers.

The developers can customize the Java command flags by specifying the entrypoint criteria in app.yaml.

 However, If the developers want a free trial of Google App Engine, they can take one on the Google Cloud.Now lets get a brief idea regarding Java 11 Runtime.

Environment of Java 11 Runtime 

Java 11 software is responsible for setting up your web service’s code.  It also provides assurance to it and helps to run your service.Let’s dive into this section to understand the environment of Java 11 Runtime in brief.

1. Compatibility of the Framework

You can launch executable JAR files by using Java 11 runtime. In Java 11 runtime, you don’t need any web-serving framework. 

However, servlet-base frameworks or libraries are not mandatory to use. You can use your local networking stacks such as Natty libraries as well.

There are some hello world samples, which are utilizing famous Java web frameworks on Google Cloud Platform GitHub respirator:

  1. SparkJava
  2. Spring Boot 
  3. Ktor
  4. Vert.x
  5. Quarkus
  6. Micronaut

2. Versions of Java

Java 11 runtime utilizes the latest version of Java 11.The App Engine updates the Java 11 automatically to its latest version when it is launched. Therefore, it will update only the minor updates and not the major version.

For example, if you launch your Java at Java 11.0.3, it will automatically update to the latest version of Java 11.0.4, but not Java 12. 

3. Reliability of Java

The libraries which are compatible with Java, will also be compatible with Java 11 runtime. However, to build, run, as well as deploy the sample apps, use Apache Maven. 

Disclosing and Controlling Reliability

To control the reliability using Maven, you need to pinpoint the reliability in the <dependence> section within the pom.xml file of your project.

Establishing the Java servlet library

Eclipse, Jetty, and Tomcat apps needs the Java servlet library. Hence, pinpoint it in your pom.xml file’s <dependence> entry:










 It is to be noted that SparkJava and SpringBoot frameworks does not need Servlet library.

Adopting Google Cloud Client Libraries for Java

You can apply the Google Cloud Client Libraries for Java by joining these lines to your pom.xml file:






You can verify the current version number by examining the sample snippet in the google cloud library web page.

4. Starting up Applications

Executable uber JAR is created by default through Spring Boot,Ktor and Micronaut frameworks. However, when Maven or Gradle creates a file of workable Uber JAR, the application is originated as the Uber JAR application by the runtime. 

App Engine will use the optional entrypoint field in your app.yaml files:

 runtime: java11

entrypoint: java -Xmx64m -jar your-artifact.jar

To acquire an HTTP request, the entrypoint will require to build a web server which uses the port fixed for them by the PORT environment variable. 

Using a personalized entrypoint, you can create and represent your application as a thin JAR file that contains your application code and direct dependencies. 

However, while launching the application only the modified files will be uploaded instead of the whole uber JAR package by the App Engine.

5. Previous Java Versions Compatibility

Java’s previous versions had many good features that people liked. The users can use the following features from the previous versions of Java to the current one:-

  1. The var keyword provides an upgraded interface. 
  2. It form maps or lists using the immutable collections without any difficulty.
  3. HttpClient helps to connect different users.
  4. Apply JPMS module system.
  5. Use different JVM languages like Groovy, Apache, Scala or Kotlin.

6. Environmental variables

 The location on your computer, list of objects, version numbers etc are all represented by using the environmental variables. The environmental variables are:-

GAE_APPLICATION- It is the ID of your App Engine application.

GAE_DEPLOYMENT_ID- This basically involves the ID of your current deployment.

GAE_ENV- Environment of the App Engine. Fixed to standard. 

GAE_INSTANCE- The ID of the instance your service is currently running from. 

GAE_MEMORY_MB- The total amount of memory which is free to the Application process, in MB.

GAE_RUNTIME- The stated runtime in your app.yaml file.

GAE_SERVICE- The service name stated in your app.yaml file. It will be set to default, if there is no service name stated for it. 

GAE_VERSION- This incorporates the recent version tag of your service.

GOOGLE_CLOUD_PROJECT – The GCP project ID which is associated with your application.

NODE_ENV- This is fixed to production while running your service.

PORT- HTTP requests are received by this port.

One can determine extra environmental variables in app.yaml files. Therefore,apart from NODE_ENV, the above-mentioned values cannot be modified.

7. HTTPS and Forwarding Proxies

Both forwarding proxies App Engine and HTTPs terminates HTTP connection at the load balancer. After that, it forwards request to your application. 

Therefore, some of the application needs the original IP and protocol. The IP address of the users are represented by X-Forwarded-For.

 Besides, applications requesting this data construct their web framework to trust the proxy.

8. Filesystem Access

While a changeable /tmp directory is included in the runtime, other directories have read-only access. Writing to /tmp uses up the system memory.

9. Metadata Server

App Engine’s metadata server helps you to get the information about every second of your project use.

You can easily access the metadata server through the endpoints mentioned below:

  • http://metadata

To Conclude

With the help of Java 11 runtime, you can easily create your very own App Engine Applications. 

In addition, it has made the creation of applications easier than before. As a result, you can go for Java 11 Runtime without any hesitation.

Next Post

Kotlin: Google’s Exceptional Alternative to Java

Sat Aug 31 , 2019
Kotlin programming language is a statically-typed language, that can operate on different kinds of platforms. It can operate along with Java and Java Virtual Machine.  It was introduced by JetBrains, in 2010, the company that also created IntelliJ IDEA, and was open-sourced in February 2012.  The Kotlin’s team has more […]

You May Like