Getting Started With Google App Engine and NetBeans Part 1


Note: The second part of this tutorial has been posted here. If you’ve already completed part 1 and are ready to move on, check out part 2 now.

Getting started with Google App Engine development is easy and free. For the purposes of this tutorial, I tend to focus on developing GAE apps from within the Linux platform. However, since both Netbeans and the Google App Engine SDK are multiplatform, these instructions will be pretty much the same on any of the major operating systems (Linux, Mac, or Windows).

Let’s get started.

Sign up for Google App Engine

First things first. Navigate to http://appengine.google.com and sign up to enable your Google Account for use with Google App Engine. In order to activate your account, you will need a phone that supports SMS or text messaging. Thankfully this is not hard to find these days as every major phone for the last bajillion years has this feature. :)

Create Your App

After activating your account, create your application. Once you’ve got your application name and URL solved, write them down or store the information in a text file. It’s amazing how many times I had to look up what domain Google uses for their cloud apps before they’re live. I’ve been working with Windows Azure and their appname.cloudapp.net setup for so long that I always want to type that instead. Google App Engine apps are located at appname.appspot.com.

Download the Google App Engine SDK

Download and unzip the Google App Engine SDK to a folder on your hard drive. For my projects I use the Java SDK but feel free to download the Python version if that’s your thing.

Install the NetBeans Integrated Development Environment

If you haven’t already, install the NetBeans IDE. This is the program you’ll use to manage your GAE application projects and write source code. Consequently, you are also able to publish GAE apps from within the IDE.

To install NetBeans on Mandriva Linux, type urpmi netbeans in the command-line as the root user. For Debian-based Linux such as Ubuntu, try sudo apt-get netbeans. For other operating systems, try downloading NetBeans manually from the NetBeans homepage.

If you’ve never used NetBeans before, prepare to be blown away. I love this IDE. It runs on all major platforms and has tons of plugins to help brighten your day. In fact, plugins are what we’ll be installing next.

Install the Google App Engine NetBeans Plugin

To install the Google App Engine NetBeans Plugin, follow these instructions:

  1. Start NetBeans
  2. Make note of NetBeans version number
  3. Click Tools -> Plugins
  4. Select the Settings tab
  5. Click the Add button
  6. Type “App Engine” (without the quotes) into the Name field
  7. If using NetBeans 6.7 paste http://kenai.com/projects/nbappengine/downloads/download/1.0_NetBeans671/updates.xml into the URL field
  8. If using NetBeans 6.8 paste http://kenai.com/projects/nbappengine/downloads/download/Latest_NetBeans68/updates.xml into the URL field
  9. Click the OK button
  10. Click on Available Plugins
  11. Select all Google App Engine plugins
  12. Click the Install button

Installing the Google App Engine Service in NetBeans

To install the Google App Engine service in NetBeans, follow these instructions:

  1. Start NetBeans
  2. Click on the Services tab next to Projects and Files
  3. Right-click on Servers and click Add
  4. Select Google App Engine and Click Next
  5. Select the location you unzipped the Google App Engine SDK
  6. Click Next
  7. Unless you have another service running on port 8080 and port 8765 leave the default port values
  8. Click Finish

Run the Guestbook Sample App

We are almost done! To test the install and ensure everything runs properly, let’s try running the included Guestbook sample app.

  1. Start NetBeans
  2. Click File -> New Project
  3. Under Samples, select Google App Engine -> Guestbook
  4. Click Next
  5. Enter the location in which you’d like to store this project
  6. Click Finish
  7. Click the Run button (looks like a green Play button in the toolbar)

At this point you should have a fully-functioning app loaded in your default browser, showing you a guestbook. Congratulations! If you’ve run into any errors along the way and cannot solve them on your own, please leave a comment below.

The next article in this series will focus on deploying your shiny new app to the Google App Engine service.

  • Share/Bookmark

, , , , , , , , , , , , , , ,

  1. #1 by Rick Ross on January 5, 2010 - 8:23 am

    Great start, Rocky! I’m looking forward to seeing this develop.

    Rick

  2. #2 by SMiGL on January 12, 2010 - 7:48 am

    Good tutorial. Thanks

  3. #3 by vg on January 13, 2010 - 12:01 pm

    HTTP ERROR: 500

    Bad version number in .class file

    RequestURI=/
    Caused by:

    java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:156)
    at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:69)
    at org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:548)
    at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:136)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:307)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    at com.google.appengine.tools.development.PrivilegedJspServlet.access$101(PrivilegedJspServlet.java:23)
    at com.google.appengine.tools.development.PrivilegedJspServlet$2.run(PrivilegedJspServlet.java:59)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:57)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:268)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
    at com.google.appengine.tools.development.StaticFileUtils.serveWelcomeFileAsForward(StaticFileUtils.java:80)
    at com.google.appengine.tools.development.LocalResourceFileServlet.maybeServeWelcomeFile(LocalResourceFileServlet.java:254)
    at com.google.appengine.tools.development.LocalResourceFileServlet.doGet(LocalResourceFileServlet.java:120)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:51)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:121)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:352)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at org.mortbay.jetty.Server.handle(Server.java:313)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
    at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)

    Powered by Jetty://

  4. #4 by John Rockefeller on January 13, 2010 - 1:38 pm

    My first thoughts are to verify that you have the correct version of Java installed on your machine.

    Also, check out these URLs. They may be able to point you in the right direction.

    http://www.theodorenguyen-cao.com/2009/04/08/google-app-engine-adds-java-support-review/
    http://code.google.com/p/googleappengine/issues/detail?id=1507

  5. #5 by samatshi on January 19, 2010 - 7:57 am

    Hi, I had the same prob and I set the PATH environment variable to include “C:\Program Files\Java\jdk1.6.0\bin” and it works.

  6. #6 by Mardi on January 19, 2010 - 1:18 pm

    @yg : … when I start to Run it got a same error what you had. But after I add “guestbook” to the browser ( http://localhost:8080/guestbook ) and it run well.
    I hope it help you

  7. #7 by Geraldo victorazzi on January 19, 2010 - 3:07 pm

    All work fine. I just had a little problem with the path of the jdk1.6.0_7. The compiler didn´t get find de javac program.

  8. #8 by John Rockefeller on January 19, 2010 - 3:49 pm

    samatshi :
    Hi, I had the same prob and I set the PATH environment variable to include “C:\Program Files\Java\jdk1.6.0\bin” and it works.

    Would you be able to let our readers know how you changed the PATH environment variable? It would be very helpful for those who’ve experienced this error to benefit from this knowledge.

  9. #9 by topriddy on January 20, 2010 - 3:38 am

    How about if I want to deploy an existing web project to my google app engine and not the sample google web app?

    Netbeans IDE disables the “Deploy to Google App” when I tried…

  10. #10 by Reginaldo Silva on January 21, 2010 - 11:57 am

    Cuffs know how to make a web crud, similar to jsfcrud, but using Google App Engine?

  11. #11 by Rodrigo Monteiro on January 21, 2010 - 5:47 pm

    Hi..nice tutorial!
    I did the step and worked very well!
    I wait for the next tutorial!

  12. #12 by John Rockefeller on January 21, 2010 - 8:07 pm

    @Rodrigo The next part of the tutorial has been released on this blog at this URL: http://rocky.developerblogs.com/tutorials/getting-started-with-google-app-engine-and-netbeans-part-2/

    @Reginaldo Sorry, I didn’t understand your question. Can you provide some links for backstory?

    @topriddy I don’t actually have an existing web project to launch on Google App Engine, but I’d be more than willing to post your experiences if you send it to me jrockefeller1@gmail.com.

    I’d like to hear more comments on all of your experiences. Thanks for reading!

  13. #13 by Clark on January 23, 2010 - 9:27 pm

    Hi, my Netbeans cannot read the Guestbook Project.
    I have created the project and saved it, but when I attempt to open the project, and I select the “Guestbook” Folder, this appears in the Project Name: text box
    “”

    I’m sure I have installed all the Google Plugins, should I try reinstalling them?

    Cheers

  14. #14 by John Rockefeller on January 23, 2010 - 10:42 pm

    What happens when you enter “Guestbook” in the text box and try again? I believe I had to do this step.

  15. #15 by Clark on January 23, 2010 - 10:51 pm

    I’m sorry I guess the pasted text did not get through, what I meant to paste was this:
    unrecognized project; missing plug-in?
    Also the Project Name textbox was greyed out and did not accept entries.

    Cheers

  16. #16 by John Rockefeller on January 23, 2010 - 10:53 pm

    Clark :
    I’m sorry I guess the pasted text did not get through, what I meant to paste was this:
    unrecognized project; missing plug-in?
    Also the Project Name textbox was greyed out and did not accept entries.
    Cheers

    Very strange. Make sure you’re running the latest copy of NetBeans and download a fresh copy of the GAE zip from Google to be sure. Let me know, if after that, you’re still having issues.

  17. #17 by Clark on January 24, 2010 - 12:58 am

    Hi, I’m running Netbeans 6.8, and I’ve extracted a fresh copy of the GAE. The Same problem exists, I have tried reinstalling the GAE plugin, but nothing beneficial so far.

    Cheers

  18. #18 by Mark B on January 24, 2010 - 10:56 pm

    For the issue of opening the project and getting the message “unrecognized project; missing plug-in?”.
    I had a minimal NetBeans install.
    After a Google search I found a solution.
    I had to install the plugin “Java Web Applications”, then I was able to open the GuestBook project.

  19. #19 by Sundar on February 7, 2010 - 11:24 am

    Hi, I am new to for Java, Can you help with the below error that i encountered while running.

    HTTP ERROR: 500
    Error running javac.exe compiler
    RequestURI=/

    Caused by:
    Error running javac.exe compiler
    at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:473)
    at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:47)
    at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:931)
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)

  20. #20 by Sundar on February 7, 2010 - 11:28 am

    Sundar :
    Hi, I am new to for Java, Can you help with the below error that i encountered while running.
    HTTP ERROR: 500
    Error running javac.exe compiler
    RequestURI=/
    Caused by:
    Error running javac.exe compiler
    at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:473)
    at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:47)
    at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:931)
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)


    Caused by:
    java.io.IOException: Cannot run program “javac.exe”: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)

    +some more…

  21. #21 by Vulkana on February 24, 2010 - 2:13 pm

    It works without troubles. Thanks

  22. #22 by Hank on March 3, 2010 - 8:23 am

    Nice plugin for netbeans.
    It works well on my netbeans 6.8.

(will not be published)