Solved

javax.mail.NoSuchProviderException: pop3

Posted on 2003-11-20
19
2,041 Views
Last Modified: 2010-05-18
Hi,
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(Session.java:750)
        at javax.mail.Session.getStore(Session.java:550)
        at javax.mail.Session.getStore(Session.java:512)
        at javax.mail.Session.getStore(Session.java:491)

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?

     
0
Comment
Question by:scriptnov
  • 6
  • 6
  • 5
  • +1
19 Comments
 
LVL 15

Expert Comment

by:dualsoul
ID: 9790276
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

 
0
 
LVL 92

Expert Comment

by:objects
ID: 9800744
just copy the jar into your jre's 'ext' directory.
0
 

Author Comment

by:scriptnov
ID: 9802148
dualsoul,

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?

Objects,

What do you mean by "jre"?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 15

Expert Comment

by:dualsoul
ID: 9802219
> 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%
 
0
 

Author Comment

by:scriptnov
ID: 9802374
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?

and:
>set CLASSPATH=pop3.jar;%CLASSPATH%
where do I put this command?

0
 
LVL 15

Expert Comment

by:dualsoul
ID: 9803834
>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?
0
 
LVL 92

Expert Comment

by:objects
ID: 9804615
> 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.
0
 

Author Comment

by:scriptnov
ID: 9810108
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.
0
 
LVL 15

Expert Comment

by:dualsoul
ID: 9813353
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...
0
 
LVL 92

Expert Comment

by:objects
ID: 9814167
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.
0
 

Author Comment

by:scriptnov
ID: 9824918
Hi,

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.

0
 
LVL 15

Expert Comment

by:dualsoul
ID: 9827463
so, please close the topic, don't leave it open in question list
0
 

Author Comment

by:scriptnov
ID: 9830796
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!
0
 
LVL 15

Expert Comment

by:dualsoul
ID: 9833509
^))
0
 
LVL 92

Expert Comment

by:objects
ID: 9833708
Its at the same place the button is to ask a question in this topic:
http://www.experts-exchange.com/Community_Support/askQuestion.jsp
0
 

Author Comment

by:scriptnov
ID: 9857276
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 9861207
> 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 :)
0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 9885871
PAQed, with points refunded (250)

Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

809 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