YouTube Java API 问题 [英] YouTube Java API problems

查看:19
本文介绍了YouTube Java API 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 YouTube Java GData 库/API 获取某个用户的视频列表.

I'm trying to get a list of videos by a certain user using the YouTube Java GData library/API.

但是,当我尝试使用 YouTubeService service = new YouTubeService("Cyphon-MyCampusPulse-1", YOUTUBE_API_KEY); 创建服务时,出现以下运行时异常:

However, when I try to create a service by using YouTubeService service = new YouTubeService("Cyphon-MyCampusPulse-1", YOUTUBE_API_KEY);, I get the following runtime exception:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException
at scrapers.YouTubePulseScraper.<init>(YouTubePulseScraper.java:37)
at scrapers.YouTubePulseScraper.main(YouTubePulseScraper.java:153)
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 2 more

我不确定异常与我正在做的事情有何关系.任何提示表示赞赏.

I'm not sure how the exception relates to what I'm doing. Any hints are appreciated.

推荐答案

您需要将 JavaMail jar 添加到您的类路径中,其中包含 javax.mail.MessagingException.您可以在此处获取:http://www.oracle.com/technetwork/java/index-138643.html

You need to add the JavaMail jar to your classpath, which contains javax.mail.MessagingException. You can get it here: http://www.oracle.com/technetwork/java/index-138643.html

摘自文档:

GData Java 客户端库具有遵循外部依赖项.这以下部分将描述如何将这些依赖项安装在您的最喜欢的操作系统(或操作系统你在工作中被困住了).

The GData Java Client Library has the following external dependencies. The following sections will describe how to install these dependencies on your favorite operating system (or the OS that you're stuck with at work).

  • JDK(Java 开发工具包)版本 1.5+
  • Apache Ant 1.7+ 版
  • Sun 的 JavaMail API 1.4+ 中的 mail.jar
  • activation.jar 在 Sun 的 JavaBeansActivationFramewrok 中.这是仅媒体特定 API 需要包括文档列表数据 API,Picasa 网络相册 API 和 YouTube 数据应用程序接口.
  • Sun 的 Servlet API 2.3+ 版中的 servlet.jar.这仅在以下情况下是必需的执行代码示例'sample.authsub' 或sample.gbase.recipe"包.

一些 .jar 依赖项是仅需要特定样品,但为了避免构建错误,最好只是为了得到一切.选择你的选择的操作系统继续:WindowsMac 操作系统X,或者Linux.

A few of the .jar dependencies are only required for specific samples, but to avoid build errors, it's best just to get everything. Choose your operating system of choice to continue: Windows, Mac OS X, or Linux.

我添加了这个是因为如果您缺少一个依赖项,您可能会缺少其他依赖项,因此您应该仔细检查您是否拥有一切.

I've added this since if you're missing one dependency you might be missing others, so you should double check you have everything.

这篇关于YouTube Java API 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆