我已经使用旧版本的 API 将文件上传到 Google 文档,但现在 API 版本已修订,因此我无法上传。
之前我使用这些行进行授权:
DocsService service = new DocsService("MyDocumentsListIntegration-v1");
service.setUserCredentials(USERNAME, PASSWORD);
但现在它给出了这个错误:
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
有人可以帮助我吗?
最佳答案
您似乎缺少外部依赖项之一 mail.jar,它是 Sun 的 JavaMail API 的一部分。
查看此页面以获取有关如何获取它以及所有其他外部依赖项的说明:https://developers.google.com/gdata/articles/java_client_lib
关于java - 如何使用java-Google Docs Api将文件上传到Google Drive?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10883718/