Java Picasa API Directory listing not working

I want to list all album list from my picasa album. Here is the code.

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());
        }

    }

}

But the exception is occurring:

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

Please help.


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

链接地址: http://www.djcxy.com/p/20264.html

上一篇: 为什么base64类没有找到代码编译好,并设置类路径

下一篇: Java Picasa API目录列表不起作用