Link to home
Start Free TrialLog in
Avatar of y_pua
y_pua

asked on

Package problem

Hi,

I am facing the below problem while i am compiling my java program. So according to the below error, how i able to solve the problem? and where should i get those package?


package javax.mail does not exist.
package javax.mail.internet does not exist.
package javax.activation does not exits.

Thanks for yr help. Plz reply as soon as posible.
Avatar of Mick Barry
Mick Barry
Flag of Australia image

You need to install javamail and javabean activation framework.

http://java.sun.com/products/javamail/
http://java.sun.com/beans/glasgow/jaf.html
ASKER CERTIFIED SOLUTION
Avatar of umangjoshi
umangjoshi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
umangjoshi,

The packages come with install instructions :)
Avatar of y_pua
y_pua

ASKER

Dear umangioshi,

i had downloaded the javamail....but still have the problem of package javax.activation...so..what should i do now? Thanks a lot.
Avatar of y_pua

ASKER

Dear Objects
 
after i download the package from http://java.sun.com/beans/glasgow/jaf.html, which java folder should i put into?
> which java folder should i put into?

<java>/lib/ext
Avatar of y_pua

ASKER

dear,

I have installed all the packages and it was success to compile. But when i run it, the problem "Exception In Thread "main" java.lang.NoClassDefFoundError: was shown. So, according to this situation, how should i solve the problem? Thanks for yr help.
> how should i solve the problem?

You need to install the jars in the ext folders of *both* the jdk *and* the jre.
It might be simply a very titular problem.

If its giving a NoClassDefFoundError right when you're typing the java <classname> command, then just make sure that you've entered the classname with the correct case. For example, if the class containing the main () method is "Abcd", then make sure that your source-file is named "Abcd.java", and then execute the following command after compiling the program:

java Abcd

Try it... if you still face problems, then just let me know.

Hey,

It is a common case that you need jars to compile against but also extra jars to run against.  This is because the implementations of the interfaces you compiled against are not known until runtime and is a pretty basic Java concept.

So what you have here is successful compilation against the JavaMail API interfaces, but no 'provider' of these interfaces at runtime.  You can download one from Sun for SMTP no problem.

It sounds like you need a better understanding of the issues you are facing:

http://www.kevinboone.com/classpath.html
http://java.sun.com/products/javamail/FAQ.html

As an aside, it's generally not a good idea to put Jars in lib/ext, as there they will always be picked up by the classloaders first (prepended to classpath), and this may prove problematic in the longer term.
> it's generally not a good idea to put Jars in lib/ext

If this is the case (which I don't believe it is) then what is the purpose of the 'ext' directory?

> and this may prove problematic in the longer term.

why?

How about rating it now?