seenuv
asked on
About JavaMail;
Please have a look in the snippet of this code
I am just trying to get a number of messages in a folder.
import javax.mail.*;
import java.io.*;
import java.net.*;
import java.util.*;
class first{
public static void main(String[] args) throws MessagingException{
URLName urln = new URLName("164.164.61.24");
Properties pros = System.getProperties();
Session session = Session.getDefaultInstance (pros, null);
Store store = session.getStore();
store.connect();
Folder f = store.getDefaultFolder();
System.out.println("The count is " + f.getMessageCount());
}
}
It is compiling perfectly but when it comes to runtime it is giving me this error
C:\jdk1.2\bin\java.exe first
Working Directory - C:\javamail\testing\
Class Path - c:\jdk1.2\lib\;c:\jsdk2.1\ servlet.ja r;c:\jsdk2 .1\server. jar;c:\jav amail\java mail-1.1.2 \mail.jar; .;C:\kawa3 21\kawacla sses.zip;c :\jdk1.2\l ib\tools.j ar;c:\jdk1 .2\jre\lib \rt.jar
javax.mail.NoSuchProviderE xception: Invalid protocol: null
at javax.mail.Session.getProv ider(Sessi on.java:20 8)
at javax.mail.Session.getStor e(Session. java:306)
at javax.mail.Session.getStor e(Session. java:286)
at javax.mail.Session.getStor e(Session. java:272)
at first.main(first.java:11)
Exception in thread "main" Process Exit...
Pleaes help me to solve this error
I am just trying to get a number of messages in a folder.
import javax.mail.*;
import java.io.*;
import java.net.*;
import java.util.*;
class first{
public static void main(String[] args) throws MessagingException{
URLName urln = new URLName("164.164.61.24");
Properties pros = System.getProperties();
Session session = Session.getDefaultInstance
Store store = session.getStore();
store.connect();
Folder f = store.getDefaultFolder();
System.out.println("The count is " + f.getMessageCount());
}
}
It is compiling perfectly but when it comes to runtime it is giving me this error
C:\jdk1.2\bin\java.exe first
Working Directory - C:\javamail\testing\
Class Path - c:\jdk1.2\lib\;c:\jsdk2.1\
javax.mail.NoSuchProviderE
at javax.mail.Session.getProv
at javax.mail.Session.getStor
at javax.mail.Session.getStor
at javax.mail.Session.getStor
at first.main(first.java:11)
Exception in thread "main" Process Exit...
Pleaes help me to solve this error
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.