javax.mail.NoSuchProviderException: pop3

I have a small e-mail program that works fine from within the IDE, but when running the program as a native executable it gives a
"javax.mail.NoSuchProviderException: pop3" when I try to connect to the mailserver.

javax.mail.NoSuchProviderException: pop3
        at javax.mail.Session.getService(
        at javax.mail.Session.getStore(
        at javax.mail.Session.getStore(
        at javax.mail.Session.getStore(

I think it has to do with the pop3.jar file.This executable jar file contains the information needed, but I don't know how to pass it to the program. I can include the pop3.jar file in my application jar file, but then what? How do I pass it to the manifest file?

any suggestions?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you should include your pop3.jar (and all other files from JavaMail framework too, like smtp.jar, mail.jar) in your classpath.
   you can do it many ways, for instance:

   java -cp pop3.jar;mail.jar;smtp.jar;your_programm_jar SomeClassToRun

, this assuming you have all jars in one directory

   or you can just set your CLASSPATH envioroment variable to point this .jar files

Mick BarryJava DeveloperCommented:
just copy the jar into your jre's 'ext' directory.
scriptnovAuthor Commented:

My program doesn't send messages, so I don't think I need the smtp.jar.
I use JBuilder and while building the archive it gives the possiblility to include required classes and known resources. I included both
the javax.mail and javax.activation packages.
These packages are now included in my program's executable jar file.
I've packaged the pop3.jar in the same directory as the executable and set up the manifest file like this :

Manifest-Version: 1.0
Class-Path: pop3.jar
Main-Class: gui.Start

but I keep getting the same errormessage. Can you see what's wrong?


What do you mean by "jre"?
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

> My program doesn't send messages, so I don't think I need the smtp.jar.
i've just said it to illustarate idea of including all JavaMail framework :)

>I've packaged the pop3.jar in the same directory as the executable
so, why not to include it in CLASSPATH?

for instance this way:
      set CLASSPATH=pop3.jar;%CLASSPATH%
scriptnovAuthor Commented:
wasn't the classpath set in the manifest?
if not, what's the use of the line "Class-Path: pop3.jar" in the manifest if this doesn't set the classpath?

where do I put this command?

>wasn't the classpath set in the manifest?
it depends on how your launcher behave

> where do I put this command?
in the command line :), before you run your application

JBuilder have created .exe for you? or .jar?
Mick BarryJava DeveloperCommented:
> What do you mean by "jre"?

Java Runtime Environment.
ie. where Java is installed, if you do a file search for "ext" directory you should find it.

> wasn't the classpath set in the manifest?

yes it should have been

Can you post the command you are using to run it.
scriptnovAuthor Commented:
what I'm trying to do is create an installer package for Windows for my application.(the app works fine in the IDE).
JBuilder created an executable .jar file and .exe file. So to run the app I doubleclick the .exe file :) or the jar file.
Both give the same error. I  added "Class-Path: pop3.jar" in the manifest. Is that all that's needed to set the classpath is there an aditionnal command needed? If so, I need to be able to include it into the installer package.
I added all references to the mail api and activation.jar in the classpath on my machine.
this is my classpath : C:\j2sdk1.4.2\bin;C:\j2sdkee1.3.1\lib\j2ee.jar;D:\programmas\jakarta-ant-1.5-bin\jakarta-ant-1.5\bin;C:\javamail-1.3.1\mail.jar;C:\jaf-1.0.2\activation.jar;C:\javamail-1.3.1\lib;D:\cleanerapp\cleaner\pop3.jar;
I also added the pop3.jar in the ext directory of the jre. Keep getting the same error.
hm... try to make simple .jar file, and run it like this:
       java -jar YourJarFile
do you still have error?

hm....and also, please post the code where you using JAvaMail, may be you are doing something wrong...
Mick BarryJava DeveloperCommented:
Could be a problem with installation of JavaMail on the box you are running it on.

> I added all references to the mail api and activation.jar in the classpath on my machine.

I'd suggest adding them to the ext directory.
scriptnovAuthor Commented:

The problem seems to be with JBuilder. When I manually create a .jar file the .jar file executes ok, and turning the Jar into an exe works fine aswell.
So I guess this problem is solved.
Thank you both for replying.

so, please close the topic, don't leave it open in question list
scriptnovAuthor Commented:
and HOW do you do this? I,ve been searching this website for 15 minutes to find out how.
I cannot find a button to submit a question on community support anywhere.
I did lke the previous version of this website better!
Mick BarryJava DeveloperCommented:
Its at the same place the button is to ask a question in this topic:
scriptnovAuthor Commented:
Thank you , objects.

I didn't want to "Ask (my) question to have these IT experts collaborate to solve (my) toughest IT questions!"
I just wanted to close this question! Anyway, it's done now.
Mick BarryJava DeveloperCommented:
> I didn't want to "Ask (my) question to have these IT experts
> collaborate to solve (my) toughest IT questions!"

The link, not this page :)
PAQed, with points refunded (250)

Friendly Neighbourhood Community Support Admin

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.