Google Calendar API Java库存在问题

时间:2011-09-25 05:28:46

标签: java

我尝试使用Google Calendar API Java库,并从示例中复制此代码:

CalendarService myService = new CalendarService("abc");
try {
    myService.setUserCredentials("авaea@gmail.com", "1111223");
} catch (AuthenticationException e) {
    // TODO Auto-generated catch block

}

我从源代码下载了库:gdata-client-1.0,gdata-calendar-2.0,但是我收到了错误:

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:555)
    at Test.main(Test.java:29)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 4 more

我哪里可以搞错?

1 个答案:

答案 0 :(得分:0)

  

引起:java.lang.ClassNotFoundException:com.google.common.collect.Maps

在运行时类路径中找不到提到的类。提到的课程是partGuava。因此,如果您下载并将其放入运行时类路径中,则此错误应该消失。