YouTube Java 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
我不确定如何例外与我正在做的事情有关。任何提示表示赞赏。
I'm trying to get a list of videos by a certain user using the YouTube Java GData library/API.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将 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
Edit:
Extracted from the documentation:
I've added this since if you're missing one dependency you might be missing others, so you should double check you have everything.
您需要 Java Mail,可从 Maven 存储库:
You need Java Mail, which is available from Maven Repository: