dcsimg
Lots of java.lang.NoClassDefFoundError.
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andrew_Modelski
Posted On:   Sunday, August 3, 2003 01:24 AM

I am trying to get a simple JavaMail program running that merely sends an email. I got the code from a tutorial and I am pretty sure there is nothing wrong with it. It compiles with no problems. The problem is that when I try to run it I get the java.lang.NoClassDefFoundError error telling me it can't find some class. I have already eliminated the first error by adding the class' location to my CLASSPATH variable only to get another similar error. I could of course track down each of these annoying classes and add their locations to my CLASSPATH variable, but, seeing as there are tons of jar files, this could get pretty grueling. Is their something wrong with my J2EE or J2SE installations that    More>>

I am trying to get a simple JavaMail program running that merely sends an email.



I got the code from a tutorial and I am pretty sure there is nothing wrong with it. It compiles with no problems.



The problem is that when I try to run it I get the java.lang.NoClassDefFoundError error telling me it can't find some class. I have already eliminated the first error by adding the class' location to my CLASSPATH variable only to get another similar error. I could of course track down each of these annoying classes and add their locations to my CLASSPATH variable, but, seeing as there are tons of jar files, this could get pretty grueling.



Is their something wrong with my J2EE or J2SE installations that caused this annoyance?



Is their an easier way to tell Java where these classes are than adding all of these locations to my CLASSPATH variable?



This whole CLASSPATH thing has been pretty annoying. If anyone can give me some pointers I would greatly appreciate it.



On a side note, is there a better forum section to ask this question in?

   <<Less

Re: Lots of java.lang.NoClassDefFoundError.

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, August 4, 2003 07:56 AM

The whole CLASSPATH thing is indeed pretty annoying, and has been, ever since 1985 or so when the "CLASSPATH" variable first began to be used (in the "BE2" 2nd version of the Andrew Toolkit, which evolved into the Java AWT etc.). But that's how it is, unfortunately, if you want dynamic loading at runtime.

Re: Lots of java.lang.NoClassDefFoundError.

Posted By:   prabhu_r  
Posted On:   Monday, August 4, 2003 02:23 AM

You just need to include the mail.jar, activation.jar and the standard jdk jars in your classpath variable or the


-classpath option in the javac and java commands. Hope this will solve your problem

Re: Lots of java.lang.NoClassDefFoundError.

Posted By:   John_Kohler  
Posted On:   Sunday, August 3, 2003 04:31 PM

What class is not found? I got a javax.activation.DataSource when trying to send a MimeMessage. Make sure the JavaBean Activation Framework jar file is in your path. You can get it at http://java.sun.com/products/javabeans/glasgow/jaf.html. The only jars I have in my path when I ran my SendMailDemo program was rt.jar, mail.jar and activation.jar. HTH, -J
About | Sitemap | Contact