YouTube 的谷歌数据 API

发布于 2024-08-01 16:39:50 字数 1307 浏览 7 评论 0原文

我正在尝试运行 Google Data API 附带的示例程序。 我在以下行中收到运行时错误

YouTubeService myService = new YouTubeService("gdataSample-YouTube-1");

错误如下:

run:
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:532)
        at YouTubeReadonlyClient.main(YouTubeReadonlyClient.java:713)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 4 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

我尝试了 Google Data API 版本 1.35.0 和 1.35.1,并且在两种情况下都收到相同的错误。

I'm trying to run the sample program, which comes with Google Data API. I get a runtime error at following line

YouTubeService myService = new YouTubeService("gdataSample-YouTube-1");

The error is the following:

run:
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:532)
        at YouTubeReadonlyClient.main(YouTubeReadonlyClient.java:713)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 4 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

I tried both Google Data API versions 1.35.0 and 1.35.1, and I get the same error in both cases.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦过后 2024-08-08 16:39:50

看起来您的类路径中没有集合库。

它位于 zip 文件的 gdata/java/deps 目录中。 将 google-collect-1.0-rc1.jar 文件包含在您的类路径中,应该没问题。 (您可能还需要jsr305.jar - 我不确定。)

Looks like you don't have the collections library in your class path.

It's in the gdata/java/deps directory in the zip file. Include the google-collect-1.0-rc1.jar file in your classpath and you should be fine. (You may also need jsr305.jar - I'm not sure.)

请远离我 2024-08-08 16:39:50

三个小步骤:

Three little steps:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文