During myeclipse development, the following errors may occur during runtime:
Exception in thread "Main" Java. Lang. noclassdeffounderror: COM/Sun/mail/util/lineinputstream
The reason is that the jar package version is inconsistent. javamail conflicts with the packages in Java ee 5 libraries/javaee. Jar/mail.
The interface package in javamail1.4 conflicts with the interface package in j2ee5, resulting in the following errors frequently reported in unit tests:
Java. Lang. noclassdeffounderror: COM/Sun/mail/util/bencoderstream
Of course, this error is because the javamail implementer is not introduced into the project (no package is imported), but after the package is imported, another error occurs:
Java. Lang. noclassdeffounderror: COM/Sun/mail/util/lineinputstream
Exception in thread "Main" Java. Lang. noclassdeffounderror: javax/activation/datasource
Activation. jar file not imported.
At this time, even Web containers cannot be started. Some netizens often make a bad fortune for these two exceptions. Changing j2ee1.4 will affect the project. However, you must clarify the concept and solve the problem. In j2ee5, the mail. jar package defines only interfaces. If it is not implemented, it cannot actually send emails. However, development and compilation must be successful, because it is compiled for J2EE specifications.Program. At runtime, sun's javamail1.4 implementation was used to start sending emails,
Solution: Remove j2eelibary from this project.