Friday, August 9, 2013

Building a Google Appengine Environment for Java

Why

As of this writing the Eclipse plugins, and the directions that Google offers for setting up an environment are broken.

Download and extract resources

First, start downloading all the packages and software you will need. I will be installing this on a Windows 7 64-bit machine, but I'm using the 32-bit packages to ensure compatibility. Feel free to try the 64-bit versions if you like. Now, begin downloading your packages.

Google Eclipse Plugin

Go to this page and get the latest plugin.
https://developers.google.com/eclipse/docs/install-from-zip
Note the version of Eclipse that is supported! As of this writing the latest supported version is 4.3 so I will be using version 4.3 of Eclipse.

Eclipse Java EE version

Go and grab the Eclipse IDE for Java EE Developers from the Eclipse download page. Make sure that the version you download matches the version of the Google Plugin above!
http://www.eclipse.org/downloads/

Java 7 JDK and JRE

Go get the latest Java 7 JDK and JRE. You will need both!
http://www.oracle.com/technetwork/java/javase/downloads/index.html

Get the GWT SDK

Get the GWT SDK zip file, not the Plugin for Eclipse that is offered at the top of the page. As of this writing the plugin will not download through eclipse.
http://www.gwtproject.org/download.html

Get the SDK

Get the Appengine SDK for java. I would grab the latest version in 
https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Java 

Extract and install Packages

To make this guide a bit easier to follow I will be downloading all of these into one folder called c:\appenginedev. Within appenginedev there will be three sub-folders: tools, eclipse, and workspace. Go ahead and create them now, but do not put anything in them. We will begin that process now.

Extract the GWT and the SDK

Extract the contents of appengine-java-sdk and move it into the tools folder. Do the same with the gwt that you downloaded. When complete you should have two folders within tools. Mine are called appengine-java-sdk-1.8.3 and  gwt-2.5.1. Within each of these folders is a bunch of files and folders.

Install Java 7 JDK and JRE

Run the install s for the Java 7 JDK and the JRE. Note the installation directory for the JDK. Mine is C:\Program Files (x86)\Java\jdk1.7.0_25.

Extract Eclipse

Extract eclipse into the Eclipse folder that you created. (Easy Huh?)

Configure Eclipse

This is the tricky part!

Modify eclipse.ini

  1. Open eclipse\eclipse.ini in a text editor.
  2. Find the line that starts with openfile
  3. Add the below lines just under openfile.
-vm
C:\Program Files (x86)\Java\jdk1.7.0_25\bin\javaw.exe
Note the first part of the path should point to the location of your JDK!
Your eclipse.ini should now look something like:
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20130521-0416
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:\Program Files (x86)\Java\jdk1.7.0_25\bin\javaw.exe
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
Now save eclipse.ini, and start Eclipse!

Select Workspace

Eclipse will ask you to select a workspace, put it where ever you like, but I put mine in c:\appenginedev\workspace.

Install the Google plugins

  1. In eclipse go to Help -> Install New Software...
  2. Click on Add...
  3. Click on Archive...
  4. Browse to c:\appenginedev\com.google.gdt.eclipse.suite.4.3.update.site_3.3.0.zip
  5. Click Open
  6. Click Ok
  7. Select Google Plugin for Eclipse (required)
  8. Select GWT Designer for GPE (recommenned)
  9. Click Next
  10. Click Next
  11. Accept the both Licenses
  12. Click Finish
  13. If prompted about unsigned content click Ok
  14. When asked to restart Eclipse clock Yes
  15. When it's back up, go to Window -> Preferences
  16. In the list go to Google -> App Engine
  17. Click Add...
  18. Click Browse...
  19. Browse to c:\appenginedev\tools\appengine-java-sdk-1.8.3
  20. Click Ok
  21. Click Ok
  22. Click on Google -> Web Toolkit in the list
  23. Click Add...
  24. Click Browse...
  25. Browse to c:\appenginedev\tools\gwt-2.5.1
  26. Click Ok
  27. Click Ok
  28. Click Ok

Done!

From this point on Google's documentation does nicely, so I will point you there. Enjoy!
https://developers.google.com/appengine/docs/java/