Recipe 27.1 Getting Set Up with Google s Web API

Recipe 27.1 Getting Set Up with Google's Web API


You want to use Google's Web API to make Java-enabled searches of Google's vast web index.


Download the Google Web APIs SDK. Create a Google account and get a license key that allows the use of Google's Web API.


The Google Web APIs SDK includes an archive named google.jar . This file contains the classes that your program will use to connect with Google during searches. Here are the specific steps you take to prepare the web application for connecting with Google:

  1. Download the zipped SDK from Unpack this file into a directory (named googleapi in Beta Version 3.0 of the Google Web APIs). This directory contains google.jar , along with a lot of code samples and documentation.

  2. Create a Google account and get a license key, which is encoded text that looks like "5W1ABCyzPSyI3rIa5Pt3DtXMatsdzaSGB." Your Java code uses this key when it queries Google's index. The query will fail if it is not accompanied by a valid key.

  3. Place the google.jar file in the WEB-INF/lib directory of the web application.

  4. Develop your Java classes for connecting with Google, using the package from the google.jar file.

See Also

The home for the Google Web APIs:; the Google web APIs SDK:

Java Servlet & JSP Cookbook
Java Servlet & JSP Cookbook
ISBN: 0596005725
EAN: 2147483647
Year: 2004
Pages: 326 © 2008-2017.
If you may any questions please contact us: