Getting error messgae when trying to use Google Health API in Eclipse

Posted on 2009-04-28
Medium Priority
Last Modified: 2013-11-13
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps
      at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:118)
      at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:100)
      at com.google.gdata.client.Service.<clinit>(Service.java:512)
      at Health.main(Health.java:36)

/* INSTRUCTION: This is a command line application. So please execute this template with the following arguments:
		arg[0] = username
		arg[1] = password
 * @author (Your Name Here)
import com.google.gdata.client.GoogleService;
import com.google.gdata.data.Entry;
import com.google.gdata.data.Feed;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
 * This is a test template
  public class Health {
    public static void main(String[] args) {
      try {
        // Create a new Health service
        GoogleService myService = new GoogleService(
        "health","My Application");
        // Get a list of all entries
        URL metafeedUrl = new URL("https://www.google.com/health/feeds/profile/list");
        System.out.println("Getting Health profile entries...\n");
        Feed resultFeed = myService.getFeed(metafeedUrl, Feed.class);
        List<Entry> entries = resultFeed.getEntries();
        for(int i=0; i<entries.size(); i++) {
          Entry entry = entries.get(i);
          System.out.println("\t" + entry.getTitle().getPlainText());
        System.out.println("\nTotal Entries: "+entries.size());
      catch(AuthenticationException e) {
      catch(MalformedURLException e) {
      catch(ServiceException e) {
      catch(IOException e) {

Open in new window

Question by:VamsiRaju
1 Comment

Accepted Solution

VamsiRaju earned 0 total points
ID: 24258246
I got the problem solved. Just add the google-collections.jar to the classpath.

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question