Java Picasa API目录列表不起作用

时间:2013-11-24 16:44:28

标签: java android exception picasa

我想从我的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”java.lang.NoClassDefFoundError中的

helloException:   在MyMain.main(MyMain.java:20)的javax / mail / MessagingException导致   by:java.lang.ClassNotFoundException:javax.mail.MessagingException     在java.net.URLClassLoader $ 1.run(未知来源)at   java.net.URLClassLoader $ 1.run(未知来源)at   java.security.AccessController.doPrivileged(Native Method)at   java.net.URLClassLoader.findClass(未知来源)at   java.lang.ClassLoader.loadClass(未知来源)at   sun.misc.Launcher $ AppClassLoader.loadClass(未知来源)at   java.lang.ClassLoader.loadClass(未知来源)......另外1个

请帮忙。

1 个答案:

答案 0 :(得分:0)

添加mail.jar,activation.jar和additional.jar