gpt4 book ai didi

Java Picasa API 目录列表不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 15:23:10 26 4
gpt4 key购买 nike

我想列出我的 picasa 相册中的所有相册列表。这是代码。

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import com.google.gdata.client.photos.PicasawebService;
import com.google.gdata.data.photos.AlbumEntry;
import com.google.gdata.data.photos.UserFeed;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;


public class MyMain {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("hello");
PicasawebService myService = new PicasawebService("exampleCo-exampleApp-1");
try {
myService.setUserCredentials("myMailAddress@gmail.com", "myPassWord");
} catch (AuthenticationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
URL feedUrl=null;
try {
feedUrl = new URL("https://picasaweb.google.com/data/feed/api/user/myMailAddress?kind=album");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

UserFeed myUserFeed=null;
try {
myUserFeed = myService.getFeed(feedUrl, UserFeed.class);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

for (AlbumEntry myAlbum : myUserFeed.getAlbumEntries()) {
System.out.println(myAlbum.getTitle().getPlainText());
}

}

}

但是发生了异常:

helloException in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException at MyMain.main(MyMain.java:20) Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException at java.net.URLClassLoader$1.run(Unknown Source) 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、activation.jar和additional.jar

关于Java Picasa API 目录列表不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20177080/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com