Writing Java Hello World for Google app engine
After hearing the buzz about java support in Google App Engine I decided to write a hello, world application and run it on Google App Engine.
Add Google plugin for Eclipse
The first step is to add the Google 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.
Create new project in eclipse
Create a new Web Application Project using File > New > Web Application Project
Specify your project name and package name. To keep the application simple, uncheck ‘use GWT’ and check ‘Use app engine’, then click ‘Finish’
This generates a working web application. The project structure looks like this:
Run your web application locally
Right click on your application and click on Run as… > Web Application.
This launches your web application locally on port 8080. You can access your application by typing the URL:
http://localhost:8080/hellogoogleapp
…. and your app says “Hello, World”!!
Create a Google App Engine account
Before you can deploy you hello world application to google app engine, you need to create an account on google app engine.
http://appengine.google.com/
You can sign in with your existing google account.
When you try creating your first application you must verify Your Account by SMS. Simply enter your mobile phone number and type the code that you get in the SMS.
Select a unique application id in Google App Engine
Application id, like login name must be a unique name. You need to select a unique application id before proceeding. After selection the application id, http://<your application id>.appspot.com is reserved for your application.
Configure your eclipse application to use this application id
Right click on your eclipse project > Google > App engine settings. Enter your application id. Alternatively you can directly modify your appengine-web.xml file to add your application id.
<application>hellogoogapp</application>
Deploy your app to App Engine
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.
The above step should deploy your application to Google app engine. At the time of writing this feature is available to only the first 10000 users. If you are not one of the first 10,000 you will get the following message on the console.
java.io.IOException: Error posting to URL: http://appengine.google.com/api/appversion/... 400 Bad Request Invalid runtime specified. Unable to upload app: Error posting to URL: http://appengine.google.com/api/appversion/... 400 Bad Request Invalid runtime specified.
If you don’t have access to the java version yet, you can apply for permission here.
After applying you should receive an email from google, it may take upto 1 or 2 days to get the email. The email looks like this:

Try deploying the application again now. This time the deployment should be successful. You should see the following output on the console:
Creating staging directory Scanning for jsp files. Scanning files on local disk. Initiating update. Cloning 1 static files. Cloning 13 application files. Uploading 5 files. Uploaded 1 files. Uploaded 2 files. Uploaded 3 files. Uploaded 4 files. Uploaded 5 files. Deploying new version. Will check again in 1 seconds Closing update: new version is ready to start serving. Uploading index definitions. Deployment completed successfully
Access your live application on google app engine
Login to google app engine. You should see you application on the application overview page.
You should see version 1 of your newly deployed app. Click on this link. This link should be your http://<applicationid>.appspot.com, for example http://hellogoogapp.appspot.com/.
Your application page shows you a list of all available servlets.
Go ahead and click on the hello world servlet.
…. And finally, your google app says “Hello, world”. Here is the link to the app that I created: http://hellogoogapp.appspot.com/hellogoogleapp
References
Related posts:


















Nice post. Specially since I was kind of out of date with Google support for Java – it made interesting reading.
Hi
I have a Doubt!. I got the invitatin letter from Google for teh new java App engine. I already got registered for python.So when i tried to click the link sent by email with the sms check done,I was able to create only ython based not jave based.Can you pleasse help me on this?
rgds
GK
Writing Java Hello World for Google app engine | Vineet Manohar’s blog…
After hearing the buzz about java support in Google App Engine I decided to write a hello, world application and run it on Google App Engine….
Informative. Recently I’ve started using the Google SDK and found that the Plug-in was really helpful to develop Java app for GAE platform.
I hope that this will make a big impact amongst the Java developers.
sezhian, how are you deploying your app to app engine? I used google eclipse plugin and it worked fine after I got the email from google.
Nice post, really help a lot.
sezhain , your old GAE account will work for java. Atleast its working for me.
I thank you for this post now I can really work on google apps.
Vote here if you are looking for maven support in GAE
http://code.google.com/p/googleappengine/issues/detail?id=1296
Thanks a lot..Its really simple to understand now.
Thanks for in depth details in this tutorial, but what I was looking for was something that gives me really what’s happing under the hood, I mean IDE cover the low level details, that sometimes make the difference.
I actually kept lookin’ until I found this interesting article that only used a Linux terminal, to do it all, check this out.
http://www.tritux.com/blog/2010/10/21/a-java-hello-world-application-on-google-app-engine-part-1/12/1
very nice post, thanks!!!
Thank you a lot, you’re too helpful !
Hi Vineet,
GREETINGS OF THE DAY
Your post is really helpful for me to implement my first gae app. i have uploaded xml file with docs provided at http://code.google.com/appengine/docs/java/blobstore/overview.html. but i not getting anything about how to access this uploaded file. when i upload it it get uploaded in folder war/web-inf/appengine-generated with blobkey as name. but i can’t get access it in code. can u help me with some code reagarding this. please tell me if you have any idea. Thanks in advance.
very very helpful for me. i am deploying my app to google app engine. But always get error : 400 bad request, i spended a lot of time to resolve this error. now i can do it.
Thanks very much.
Was looking for a starter to use Google’s app engine and you did not disappoint. Cheers !!!