Google App Engine Java SDK advices

It would have been nice if I knew this beforehand about Google App Engine Java SDK

This article originally appeared on https://techtavern.wordpress.com

GAE infrastructure is a kind of Java 7 platform. You may compile your code using the current Java 8 SDK, as long as source code version is set to Java 7. You may deploy and run your application locally with Java 8, too.

However, when deploying to Google infrastructure, there are some pitfalls.

  1. The appcfg script pre-compiles your JSP files using the Java SDK on the PATH or set by JAVA_HOME system property. If this SDK is not Java 7, appcfg will create and upload incompatible class files.
  2. Java SDK 7 is not available anymore for download on Oracle website.

I have found Java SDK 7 (7u79) installer for download still available on http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Probably, you do not want do pollute your development environment by installing a deprecated SDK. This article explains how to extract a portable SDK without running the installer. And if you do not want to mess your current PATH and JAVA_HOME system variables globally, you may set them within the appcfg.cmd file.

setlocal
set JAVA_HOME=C:\Users\Daniel\Programas\jdk7
set PATH=C:\Users\Daniel\Programas\jdk7\bin
java -Duser.language=EN -Xmx1100m -cp "%~dp0\..\lib\appengine-tools-api.jar" 
     com.google.appengine.tools.admin.AppCfg %*
endlocal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: