addisuc
asked on
java.lang.ClassNotFoundException
I am getting this exception even if I have exactly same top level public class name and the filename.
The exception is:
Exception in thread "Main Thread" java.lang.NoClassDefFoundE rror:
...../common/util/email/Po stEmail
Caused by: java.lang.ClassNotFoundExc eption: com.breeze.common.util.ema il.PostEma il
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:202)
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java:19 0)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:306)
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java :308)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:247)
And the class def is:
import javax.mail.Message;
import javax.mail.MessagingExcept ion;
import javax.mail.Multipart;
import javax.mail.PasswordAuthent ication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.Intern etAddress;
import javax.mail.internet.MimeMe ssage;
public class PostEmail {
.......
public static void main(String[]args){
//class is instantiated and used here
}
}
Any help is appreciated!
Thanks
The exception is:
Exception in thread "Main Thread" java.lang.NoClassDefFoundE
...../common/util/email/Po
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
And the class def is:
import javax.mail.Message;
import javax.mail.MessagingExcept
import javax.mail.Multipart;
import javax.mail.PasswordAuthent
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.Intern
import javax.mail.internet.MimeMe
public class PostEmail {
.......
public static void main(String[]args){
//class is instantiated and used here
}
}
Any help is appreciated!
Thanks
ASKER
I already had that package import but issue was caused by some other(unknown). I just recreated my clearcase view and issue goes away.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It is looking for PostEmail to be in a package, and so you must have a line in your class def to say that it is in this package. So add the following line to the top of your PostEmail.java file...
Open in new window