clueless newbie -- how to open mbox?

Matej Cepl <[email protected]> Wed, 02 May 2007 14:48:03 +0200
Newsgroups gmane.comp.java.classpath.extensions.javamail
Organization Red Hat Czech, s.r.o.
Message-ID <[email protected]>
Hi, can somebody help me with this:

[matej@chelcicky mdir2mbox]$ cat -b Mdir2mbox.java 
     1  import java.util.*;
     2  import javax.mail.*;

     3  public class Mdir2mbox {
     4          public static void main(String[] args) throws \
     MessagingException {
     5                  String urlStr = "/home/matej/.eclipse\
/workspace/Mdir2mbox/examples/test";
     6                  Properties properties = new Properties();
     7                  Session session = Session.getInstance(properties);
     8                  URLName mboxURL = new URLName("mbox://"+urlStr);
     9                  Store store = session.getStore(mboxURL);
    10                  Folder folder = store.getDefaultFolder();
    11                  if(!folder.exists())
    12                          folder.create(Folder.HOLDS_MESSAGES);
    13          folder.open(Folder.READ_WRITE);
    14                  System.out.println(folder.getMessageCount());
    15          }

    16  }
[matej@chelcicky mdir2mbox]$ ls -lh examples/test
-rw-r--r-- 1 matej matej 22K kvě  1 01:02 examples/test
[matej@chelcicky mdir2mbox]$ java Mdir2mbox
Exception in thread "main" java.lang.NullPointerException
   at Mdir2mbox.main(Mdir2mbox.java:12)
[matej@chelcicky mdir2mbox]$ rpm -q classpathx-mail
classpathx-mail-1.1.1-4jpp.2
[matej@chelcicky mdir2mbox]$ java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.1 20070105 (Red Hat 4.1.1-51)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[matej@chelcicky mdir2mbox]$ 

Whatever I do I don't see what I am doing wrong in this case.  There is not
much examples on how to use java.mail with folders, but when I look at this
(among others)
http://article.gmane.org/gmane.comp.java.classpath.extensions.javamail/116 it
seems to me, that I am not doing anything extremely silly (it's Fedora Core 6).

Is there any hope for me, please?

Thanks a lot,

Matěj Cepl