Google App Engine For Java: An Introduction

Published: 08 Apr 2009

A couple of days ago, Google announced that Java was now available to run on Google App Engine (GAE for short). Currently, they are only letting the first 10,000 developers who sign up for an account actually deploy a Java app:

April 2009: During this "early look" of Google App Engine for Java, the ability to upload Java applications to App Engine is reserved for a limited number of developer accounts. All users will be able to upload Java apps when we do a full release of Google App Engine for Java in the near future.

Fortunately, I was able to get an account and give it a test drive. Here's how to deploy a minimal web application without using the available Eclipse plugin:

  1. Install a Java SDK if you don't already have it installed. You will need Java version 5 or above.
  2. Download and install the Google App Engine Java SDK. I extracted the zip to my home directory and updated my system path to include ~/appengine-java-sdk-1.2.0/bin. Once this is done I can run the script.
  3. Now that the GAE Java tools are installed, it's time to create a very simple Java web app. I decided to create an app with just a single JSP.
  4. Below is the entire directory layout with the usual WEB-INF/web.xml and the single index.jsp in the web root. You will also see two files specific to GAE for Java: appengine-web.xml and appengine-api-1.0-sdk-1.2.0.jar. These are essential in order to deploy your web app to GAE for Java./
  5. Below is an example of why my appengine-web.xml file looks like. There are several configuration elements which are documented here. Note that the application value here is angrygerbils which will be located at after I upload the app.
  6. For this app, my web.xml file is actually empty except for the web-app element:
  7. Now it's time to upload the app to GAE for Java using I created an exploded directory call angrygerbilsWeb and uploaded it with the following command: update angrygerbilsWeb
  8. You should see something like the following:
  9. Once complete, you can view the app in a browser.
  10. That's it! Note that are several limitations for running Java on GAE including not being able to spawn new threads, JRE Class White List, and certain frameworks such as Struts are simply not supported. You can read more about the limitations as well as the features.