ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

YouTube Java API问题

2019-05-26 20:58:01  阅读:482  来源: 互联网

标签:java youtube youtube-api gdata-api


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

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

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

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

解决方法:

您需要将JavaMail jar添加到包含javax.mail.MessagingException的类路径中.你可以在这里得到它:http://www.oracle.com/technetwork/java/index-138643.html

编辑:
从文档中提取:

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 Development Kit) version 1.5+
  • Apache Ant version 1.7+
  • mail.jar in Sun’s JavaMail API 1.4+
  • activation.jar in Sun’s JavaBeansActivationFramewrok. This is
    only required for media specific APIs
    including Document List Data API,
    Picasa Web Album API, and YouTube Data
    API.
  • servlet.jar in Sun’s Servlet API version 2.3+. This is required only if
    executing code samples in
    ‘sample.authsub’ or
    ‘sample.gbase.recipe’ packages.

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:
07001,
07002,
or
07003.

我已经添加了这个,因为如果你错过了一个依赖关系,你可能会错过其他依赖关系,所以你应该仔细检查你有什么.

标签:java,youtube,youtube-api,gdata-api
来源: https://codeday.me/bug/20190526/1158258.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有