Calling Google from a Java Program 

Within Linux, download the Google Kit: http://www.google.com/apis/download.html.

Unzip zip file into a subdirectory of your home directory, let's call it myDir.

Read the readme file.

Run the demo program ($ is Linux prompt):

$ cd myDir/googleapi

$ java -cp googleapi.jar com.google.soap.search.GoogleAPIDemo H2deIvNQFHI9ilswRXR1h1+7IqnD7Pp4 search wolber   

The key (H2...) is one of Wolber's. You need to get your own by registering at:        

    https://www.google.com/accounts/NewAccount?continue=http://api.google.com/createkey&followup=http://api.google.com/createkey

The Google Demo is a bit difficult to understand. Copy SimpleGoogleDemo.java into the googleapi directory, and try it:

To compile,

$ javac -classpath googleapi.jar SimpleGoogleDemo.java

To run,

$ java -cp googleapi.jar:. SimpleGoogleDemo

Note that if running this sample in Windows, you'd need a semi-colon, not a colon, in the line above, e.g.,

> java -cp googleapi.jar;. SimpleGoogleDemo

In either case, the '.' is telling java to look not only in the jar file but in the current directory for the files to run.

See Windows ClassPath or Linux Class Path for more information on how classpath works in Java.

Check out http://www.google.com/apis/reference.html    for details on using the Google API generically, and

Google Java API docs for Java specific.