How to Create and Deploy a Java Web App to Google App Engine

Four Parts:Setting up the EnvironmentCreating the Application in GAECreating the Application in EclipseDeploying the App to Google App Engine

The Google App Engine is a Platform as a Service by Google. With App Engine, there are no servers for you to maintain. You simply upload your application and it’s ready to go. This article is for anyone who knows a little bit of web development and want to create a web application which is live and accessible to all. This tutorial uses Java Plugin of Google App Engine and Eclipse IDE.

Part 1
Setting up the Environment

This procedure installs the Google Plugin for Eclipse and optionally the Android Developer Tools, the Google Web Toolkit SDK, and the Google App Engine SDK.

  1. 1
    Start Eclipse, running JVM version 1.7.0 or later.
  2. Image titled P1s1
    2
    Select Help > Install New Software.
  3. Image titled Gp1s2
    3
    In the dialog that appears, enter the update site URL into the Work with text box: "https://dl.google.com/eclipse/plugin/4.3". Press the Enter key.
  4. Image titled Gp1s3
    4
    Select the checkbox next to Google Plugin for Eclipse (required). Click Next.
  5. 5
    Review the features that you are about to install. Click Next.
  6. Image titled Gp1s4
    6
    Read the license agreements and then select "I accept the terms of the license agreements". Click Finish.
  7. 7
    Click OK on the Security Warning.
  8. 8
    Click Restart Now to restart Eclipse.
  9. Image titled Gp1s5
    9
    Sign in to Google by clicking in bottom-right corner.
    • Provide the Google Account Credentials and Click Sign in.
      Image titled Gp1s6
    • Click ‘Accept’ after reading the required permissions.
      Image titled Gp1s7
    • Now you are logged in to your Google Account.
      Image titled Gp1s8
    • You are ready to build App Engine web applications and mobile backends for your Android applications!

Part 2
Creating the Application in GAE

  1. 1
    Go to appengine.google.com
  2. Image titled Gpstep (1) 1
    2
    Login to your account using google account credentials .A new page is opened where it displays all the google app engine applications created by you.
  3. Image titled Gpstep (2)
    3
    Click ‘Google Developers Console’ link. A new window opens.
  4. Image titled Gpstep (3)
    4
    Google Developers Console is opened.
  5. Image titled Gpstep (4)
    5
    Click ‘Create new Project’.
  6. Image titled Gpstep (5)
    6
    Enter the project name and edit the app ID as desired but it must be unique. An error is shown if the app id is not available.
  7. Image titled Gpstep (6)
    7
    Click Create. Your newly created app is ready. Now you can deploy the java web app code to this app id.

Part 3
Creating the Application in Eclipse

  1. Image titled Gpstep (7)
    1
    Open Eclipse. Go to File > New > Web Application Project.
  2. Image titled Gpstep (8)
    2
    Enter the project name and package name. Uncheck the Google Web Toolkit.
  3. Image titled Gpstep (9)
    3
    Click Finish.
    • Your project folder and its internal hierarchy will be created as shown in the figure.
      Image titled Gpstep (10)
  4. Image titled Gpstep (11)
    4
    Open index.html which is present in the war folder of your project.
  5. Image titled Gpstep (12)
    5
    Edit the HTML as desired. Currently we are not using any servlet hence remove the servlet link from the html.
  6. Image titled Gpstep (13)
    6
    Open web.xml and make sure that index.html is set as the welcome file.
  7. 7
    Save the project.

Part 4
Deploying the App to Google App Engine

  1. Image titled Gpstep (14)
    Image titled Gpstep (15)
    1
    Right click on the project name in the package explorer. Go to Deploy > Google #App Engine. A window will pop-up.
  2. Image titled Gpstep (16)
    2
    Click on the 'Application Settings' link. A new window will pop-up.
  3. Image titled Gpstep (17)
    3
    Enter the App ID which you previously created and click OK. Click Deploy.
  4. Image titled Gpstep (18)
    Image titled Gpstep (19)
    4
    After the app is deployed, it will open in the browser automatically. The app will be available at www.app-id.appspot.com.

Sources and Citations

Article Info

Categories: Computers and Electronics | Web Programming