How to create a Google App Engine (GAE) Java project,run and Deploy to App Engine.
In this tutorial, We'll show you how to use eclipse to create a Google App Engine (GAE) Java project, run it on localhost, and deploy it to Google App Engine account.
Assumed JDK V1.7 and Eclipse (Kepler) are installed.
1. Install Google Plugin for Eclipse
Read this guide – how to install Google Plugin for Eclipse. If you install the Google App Engine Java SDK together with “Google Plugin for Eclipse“, then go to step 2, Otherwise, get the Google App Engine Java SDK and extract it.
- After installation of GAE plugin, If u get the below marked Google icon in eclipse toolbar to confirm that you have installed GAE plugin.
2. Create New Web Application Project
In Eclipse toolbar, click on the Google icon, and select "New Web Application Project"
Figure – New Web Application Project
Figure – Deselect the “Google Web ToolKit“, and link your GAE Java SDK via the “configure SDK” link
Click "Finish", Google Plugin for Eclipse will generate a sample project automatically.
3. MyApp
Review the generated project directory.
a standard java web project structure.
MyApp/
src/
...Java source code...
META-INF/
...other configuration...
war/
...JSPs, images, data files...
WEB-INF/
...app configuration...
lib/
...JARs for libraries...
classes/
...compiled classes...
The extra is this file “
appengine-web.xml
“, Google App Engine need this to run and deploy the application.
File : appengine-web.xml
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application></application>
<version>1</version>
<!--
Allows App Engine to send multiple requests to one instance in parallel:
-->
<threadsafe>true</threadsafe>
.......
........
</appengine-web-app>
4. Run it local
Right click on the project and run as “Web Application“.
Eclipse console :
//....
INFO: Module instance default is running at http://localhost:8888/
May 06, 2014 7:13:03 AM com.google.appengine.tools.development.AbstractModule startup
INFO: The admin console is running at http://localhost:8888/_ah/admin
Access URL
http://localhost:8888/
, see output
and click on "myapp" link to load servlet
5. Deploy to Google App Engine
Register an account on https://appengine.google.com/, and create an application ID for your web application.
click on "create application"
In this demonstration, I created an application ID, named “myapp123″, and put it in
appengine-web.xml
.
File : appengine-web.xml
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>myapp123</application>
<version>1</version>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
To deploy, see following steps:
Figure 1.1 – select your project to be deployed and Click on GAE deploy button on the toolbar.
Figure 1.2 – Sign in to eclipse with your Google account and click on the Deploy button.
Figure 1.3 – If everything is fine, the myapp application will be deployed to this URL –http://myapp123.appspot.com
Done..:-) try It......Good luck!!!!!!
Comments
Post a Comment