?
Solved

About JavaMail;

Posted on 1999-12-13
1
Medium Priority
?
887 Views
Last Modified: 2013-11-24
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.jar;c:\jsdk2.1\server.jar;c:\javamail\javamail-1.1.2\mail.jar;.;C:\kawa321\kawaclasses.zip;c:\jdk1.2\lib\tools.jar;c:\jdk1.2\jre\lib\rt.jar
javax.mail.NoSuchProviderException: Invalid protocol: null
      at javax.mail.Session.getProvider(Session.java:208)
      at javax.mail.Session.getStore(Session.java:306)
      at javax.mail.Session.getStore(Session.java:286)
      at javax.mail.Session.getStore(Session.java:272)
      at first.main(first.java:11)
Exception in thread "main" Process Exit...

Pleaes help me to solve this error
0
Comment
Question by:seenuv
1 Comment
 

Accepted Solution

by:
laurentj earned 100 total points
ID: 2320598
try with
URLName urln = new URLName("pop3://user:password@164.164.61.24:110");  
and
Store store = session.getStore(urln);

Laurent.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month6 days, 16 hours left to enroll

592 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question