Saturday, June 13, 2009

App Engine Java HelloWorld tutorial

In this post we will jump right into appengine coding with the ubiquitous “Hello World” example .

For the development we will be using eclipse IDE and google provides appengine plugin for eclipse .

The first step is to add the Google App Engine plugin in eclipse using Help menu > Software Updates… > Add site>.

The site url is:

http://dl.google.com/eclipse/plugin/3.4
Restart eclipse after adding the plugin.

You will see three new icons related to appengine created in eclipse toolbar as shown below

Create a new Web Application Project using File > New > Web Application Project as shown below

Enter the project and package name and uncheck the GWT option as shown below

Then click the finish button and it will create working web application with required libraries as show below

Run the server by selecting the project and from menu Run --Run As -Web Application as shown below

This launches your web application locally on port 8080. You can access your application by typing the URL: http://localhost:8080/ as shown below

If the 8080 port is used by another application in your system then you can change the port through run --run configurations .

Once you're done with your application and you already got the Google confirmation message, you can now create an application.

Log into google appengine through URL http://appengine.google.com/ and click the create an application button ,Type in a unique Application Identifier and the Application Title. This will be used in deploying your application as shown below

Once everything is done, you can now deploy by clicking the Deploy App Engine Project icon as shown below

Configure your eclipse application to use this application id which is "gaetutorials" in this tutorial as project > Google > App engine settings as shown below

Right click on your project > Google > Deploy to app engine.You will be prompted for your user name and password. This is your google account information as shown below .

After deploying the application ,The link to access the application is http://.appspot.com i.e http://gaetutorials.appspot.com/ for this tutorial and it will list all the available servlets as shown below

When you click the Hello WorldApp Servlet it will display finally “Hello, world”.

No comments:

Post a Comment