A
Andreas Wollschlaeger
Hi folks,
i have a strange problem this morning which is just driving me nuts :-/
I am working on an app, one part is the sending of some email via
javax.mail! Here is a snippet of code:
-- snip --
java.util.Properties p = System.getProperties();
javax.mail.Session s = javax.mail.Session.getDefaultInstance(p);
Message m = new MimeMessage(s);
...
Transport t = s.getTransport("smtp");
t.connect(smtphost, username, password);
t.sendMessage(m, m.getAllRecipients());
t.close();
-- snip --
Nothing special here! Now the problem: From within Netbeans, this
compiles and runs perfectly. But, when i launch ant to build the same
stuff, javac woes:
Compiling 34 source files to C:\work\ELP_BOT\ELP_BOT\__ELP_BOT\build
__ELP_BOT\src\com\elpmedien\backorder_tool\MailHelper.java [40]
getDefaultInstance(java.util.Properties,javax.mail.Authenticator) in
javax.mail.Session cannot be applied to (java.util.Properties)
javax.mail.Session s = javax.mail.Session.getDefaultInstance(p);
^
1 error
The strange thing is, i use the same set of jars both for Netbeans and
Ant! I also tried updating mail.jar and activation.jar with the current
version from java.sun.com, same result.
If i change the invocation of getDefaultInstance() to
javax.mail.Session s = javax.mail.Session.getDefaultInstance(p,null);
the code builds, but throws an exception:
java.lang.NoClassDefFoundError: com/sun/mail/util/MailDateFormat
at com.elpmedien.backorder_tool.MailHelper.sendMail(Unknown Source)
Any ideas?
Cheers
Andreas
i have a strange problem this morning which is just driving me nuts :-/
I am working on an app, one part is the sending of some email via
javax.mail! Here is a snippet of code:
-- snip --
java.util.Properties p = System.getProperties();
javax.mail.Session s = javax.mail.Session.getDefaultInstance(p);
Message m = new MimeMessage(s);
...
Transport t = s.getTransport("smtp");
t.connect(smtphost, username, password);
t.sendMessage(m, m.getAllRecipients());
t.close();
-- snip --
Nothing special here! Now the problem: From within Netbeans, this
compiles and runs perfectly. But, when i launch ant to build the same
stuff, javac woes:
Compiling 34 source files to C:\work\ELP_BOT\ELP_BOT\__ELP_BOT\build
__ELP_BOT\src\com\elpmedien\backorder_tool\MailHelper.java [40]
getDefaultInstance(java.util.Properties,javax.mail.Authenticator) in
javax.mail.Session cannot be applied to (java.util.Properties)
javax.mail.Session s = javax.mail.Session.getDefaultInstance(p);
^
1 error
The strange thing is, i use the same set of jars both for Netbeans and
Ant! I also tried updating mail.jar and activation.jar with the current
version from java.sun.com, same result.
If i change the invocation of getDefaultInstance() to
javax.mail.Session s = javax.mail.Session.getDefaultInstance(p,null);
the code builds, but throws an exception:
java.lang.NoClassDefFoundError: com/sun/mail/util/MailDateFormat
at com.elpmedien.backorder_tool.MailHelper.sendMail(Unknown Source)
Any ideas?
Cheers
Andreas