[英]How to upload files to google drive using java-Google Docs Api?
Already I used older version of the API to upload files to Google docs but now the API version is revised, so I couldn't upload. 我已经使用API的较早版本将文件上传到Google文档,但是现在API版本已修改,因此我无法上传。
Previously I used these lines for authorization: 以前,我使用以下行进行授权:
DocsService service = new DocsService("MyDocumentsListIntegration-v1");
service.setUserCredentials(USERNAME, PASSWORD);
But now it is giving this error: 但是现在它给出了这个错误:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException
at sample.main(sample.java:15)
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
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)
... 1 more
Can anyone help me? 谁能帮我?
It seems like you are missing one of the external dependencies, mail.jar, which is part of Sun's JavaMail API. 似乎您缺少外部依赖项之一mail.jar,它是Sun的JavaMail API的一部分。
Check this page for instructions on how to get it as well as all other external dependencies: https://developers.google.com/gdata/articles/java_client_lib 检查此页面以获取有关如何获取它以及所有其他外部依赖项的说明: https : //developers.google.com/gdata/articles/java_client_lib
Check this link for a migration guide for the old GData api: http://code.google.com/p/gdata-java-client/wiki/MigratingToGoogleApiJavaClient 检查此链接以获取旧GData API的迁移指南: http : //code.google.com/p/gdata-java-client/wiki/MigratingToGoogleApiJavaClient
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.