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:
Download the zipped SDK from http://www.google.com/apis/download.html. 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.
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.
Place the google.jar file in the WEB-INF/lib directory of the web application.