Help with an error

3 views
Skip to first unread message

David

unread,
Jul 4, 2009, 9:02:26 AM7/4/09
to Google Contacts API

Hi All,

Its a couple of years since I used java and I am trying to dive
straight in her and having a small prob


Here is my code



import com.google.gdata.client.contacts.ContactsService;
import com.google.gdata.util.AuthenticationException;


public class ContactsExample {

public ContactsExample()
{
final String username = "********@gmail.com";
final String password = "*******"; // deleted for ublic posting

System.out.println("Contacting to google...");

final ContactsService myService = new ContactsService("exampleCo-
exampleApp-1");
try {
myService.setUserCredentials(username, password);
} catch (final AuthenticationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

System.out.println("Closing Connection");
}
public static void main(String[] args) {
new ContactsExample();

}

}

And here is the error

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:520)
at ContactsExample.<init>(ContactsExample.java:16)
at ContactsExample.main(ContactsExample.java:27)
Contacting to google...


probably something basic I am a bit rusty.

viku

unread,
Jul 8, 2009, 4:07:14 PM7/8/09
to Google Contacts API
I too encountered the java.lang.NoClassDefFoundError: com/google/
common/collect/Maps and solved it by downloading the google-
collect--1.0-rc2.zip from http://code.google.com/p/google-collections/
and including the google-collect--1.0-rc2.jar in my application
library.

Hope this helps.
viku

On Jul 4, 8:02 am, David <davidkbro...@gmail.com> wrote:
> Hi All,
>
> Its a couple of years since I used java and I am trying to dive
> straight in her and having a small prob
>
> Here is my code
>
> import com.google.gdata.client.contacts.ContactsService;
> import com.google.gdata.util.AuthenticationException;
>
> public class ContactsExample {
>
> public ContactsExample()
>         {
>         final String username = "*****...@gmail.com";

David

unread,
Jul 8, 2009, 6:08:44 PM7/8/09
to Google Contacts API
Thanks so much, I was going crazy. This has me up and running

On Jul 8, 9:07 pm, viku <coder...@gmail.com> wrote:
> I too encountered the java.lang.NoClassDefFoundError: com/google/
> common/collect/Maps and solved it by downloading the google-
> collect--1.0-rc2.zip fromhttp://code.google.com/p/google-collections/
Reply all
Reply to author
Forward
0 new messages