This page describes how to migrate your existing App Engine app from the Java 7 runtime to the Java 8 runtime.
Specifying the Java 8 runtime for your app
To have App Engine run your application in the Java 8 runtime, add
<runtime>java8</runtime> to your
appengine-web.xml file and redeploy the
Migrating from services not supported by the Java 8 runtime
Some deprecated services available to the Java 7 runtime are not supported in the Java 8 runtime. Google recommends that you migrate your application to the recommended alternatives and test your app in the Java 7 runtime with those changes prior to migrating to Java 8.
The following deprecated services are not available in the Java 8 runtime:
|Deprecated service||Recommended alternative|
|Cloud Endpoints v1||Migrate to v2, The product has been renamed to Cloud Endpoints Frameworks. Note that this might require you to change your Web, Android, or iOS applications.|
|AppStats (appengine-api-labs jar)||Migrate to Stackdriver Trace. The SDK generates an error for apps using the
|Channel API||Migrate to either Firebase or Pusher.|
|XMPP API||Migrate to either Firebase or one of the other alternatives to the XMPP API.|
Note that the App Engine API jar contained many repackaged classes such as
Guava, which were not intended for
customer use. If your app uses a repackaged class such as
com.google.appengine.repackaged.com.google.common.base.Optional then it will
not work when run on Java 8, because the repackaged class is now
prefixed to the class name. You should import and use the proper dependencies.
Taking full advantage of Java 8 runtime features
The following is a partial list of the advantages of migrating to the Java 8 runtime:
- Jetty 9 is now used and supports both Servlet 2.5 and 3.1 web applications including the use of servlet annotations.
- There is no longer a
java.lang.SecurityManagerinstalled at startup, which means all Java standard classes are now available and there is no longer a whitelist.
/tmpfilesystem is writable - this comes out of the app's RAM allotment.
- Network I/O can now be performed on any Java thread. App Engine API calls still require being on either a Request Thread or a thread created by the Thread Manager API.
- The full Java 8 language is now supported including the Stream API, Lambdas, and Date / Time API.