Java Picasa API目录列表不起作用
我想列出我的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());
}
}
}
但例外情况正在发生:
线程“main”中的helloException java.lang.NoClassDefFoundError:在MyMain.main处的javax / mail / MessagingException(MyMain.java:20)导致:java.lang.ClassNotFoundException:java.net.URLClassLoader上的javax.mail.MessagingException $ 1。在java.lang.ClassLoader.loadClass上的java.net.URLClassLoader.findClass(未知源代码)上的java.security.AccessController.doPrivileged(Native Method)上运行java.net.URLClassLoader $ 1.run(Unknown Source) (未知源)在sun.misc.Launcher $ AppClassLoader.loadClass(未知源)在java.lang.ClassLoader.loadClass(未知源)... 1更多
请帮忙。
添加mail.jar,activation.jar和additional.jar
链接地址: http://www.djcxy.com/p/20263.html