Re: clueless newbie -- how to open mbox?

Matej Cepl <[email protected]> Wed, 02 May 2007 20:39:36 +0200
Newsgroups gmane.comp.java.classpath.extensions.javamail
Organization Red Hat Czech, s.r.o.
Message-ID <[email protected]>
On 2007-05-02, 13:11 GMT, Chris Burdess wrote:
> Try it with something like
>
> 	Store store = session.getStore(new URLName("mbox:///home/ 
> matej/.eclipse/workspace/Mdir2mbox/examples/"));
> 	Folder test = store.getFolder("test");
> 	test.open(Folder.READ_WRITE);
>
> If you think the current behaviour is wrong, let me know how you  
> think it should work and I'll see what I can do about it. =

OK, I got your point (and you are probably right, I just hoped it 
actually works this way a minute I begun to think about set of 
folders), but still no luck. However, I have a different 
exception now ;-):

[matej@hubmaier kmail2tbfolders]$ gcj --version
gcj (GCC) 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@hubmaier kmail2tbfolders]$ gcj -C test.java 
[matej@hubmaier kmail2tbfolders]$ gij test
Exception in thread "main" javax.mail.MessagingException: Folder is read-only
   at gnu.mail.providers.mbox.MboxFolder.open\
    (classpathx-mail-1.3.1-monolithic-1.1.1.jar.so)
   at test.main(test.java:12)
[matej@hubmaier kmail2tbfolders]$ cat -b test.java
     1  import java.util.*;
     2  import javax.mail.*;

     3  public class test {
     4          public static void main(String[] args) \
        throws MessagingException {
     5                  String urlStr = "/home/matej/.eclipse\
        /workspace/kmail2tbfolders/examples/";
     6                  Properties properties = new Properties();
     7                  Session session = Session.getInstance(properties);
     8                  URLName storeURL = new URLName("mbox://"+urlStr);
     9                  Store store = session.getStore(storeURL);
    10                  Folder test = store.getFolder("test");
    11                  test.open(Folder.READ_WRITE);
    12          }
    13  }
[matej@hubmaier kmail2tbfolders]$ gij --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@hubmaier kmail2tbfolders]$ ls -lh /home/matej/.eclipse\
/workspace/kmail2tbfolders/examples/test -rw-rw-rw- 1 matej matej 
2,0M kvě  2 20:23 
/home/matej/.eclipse/workspace/kmail2tbfolders/examples/test
[matej@hubmaier kmail2tbfolders]$ 

Any ideas? BTW, is there an equivalent of bash command
readlink -f (it would be very helpful)?

Best,

Matěj