This document explains how to build and run the demo of the Java version of libphonenumber, from the command line on Linux or Mac, using Google App Engine. By following the instructions here, you can build a demo running against any revision of the Java code by supplying jar files you build on your own, or downloading the ones from Maven Central.
Download and follow the instructions to install the Java SDK of Google App Engine. This document assumes it is named as appengine-java-sdk
. You may want to rename the directory after unpacking.
Check out the Java code:
git clone https://github.com/googlei18n/libphonenumber.git
Create a symlink to your unpacked appengine sdk directory at the same level as the java
directory. Alternatively, update java/demo/build.xml
to point to the right location for the appengine sdk.
Save the libphonenumber
, geocoder
, carrier
, and prefixmapper
jars under demo/war/WEB-INF/lib/
.
You can either download them from the Maven repository or build them yourself by running:
git clone https://github.com/google/libphonenumber.git cd libphonenumber/java ant jar cp build/jar/* demo/war/WEB-INF/lib
Start the server:
cd demo ant runserver
This will start a server on your localhost, and you can try it out by pointing your browser to http://localhost:8080/.
If you get a warning from App Engine asking you to upgrade your JRE to Java 1.6 or later, you might need to install Java 1.6 and point your JAVA_HOME
to it.
JAVA_HOME
, run echo $JAVA_HOME
.update-java-alternatives -l
.JAVA_HOME
, use export JAVA_HOME=[path to Java 1.6 SDK]/jre
.Now run ant runserver
to start the server on your localhost.
If you want to upload the demo to your own App Engine application, follow the steps to register an application with App Engine.
Then run:
../appengine-java-sdk/bin/appcfg.sh update war
The demo will be uploaded to http://application-id.appspot.com/
.