1

I am sorry if the question is already repeated as i did not find suitable answer in stack overflow.

I have written a code for automatic sending of email when the count should be less than 20.

The code seems to compile and run in Eclipse. but when i try to run in the Linux terminal I am getting an error

 Exception in thread "main" java.lang.NoClassDefFoundError

Can any of you help me?

Shashanth
  • 4,539
  • 7
  • 35
  • 48
  • Can You paste here the way You are running the java code? Are You running it from a jar? You are probably missing the classpath with dependencies. Go on and paste a java command You use to run in unix and will be able to help You – maslan Sep 21 '18 at 08:26
  • Your problem shows two kinds of `NoClassDefFoundException` : one for `javax.mail.MessagingException` and one for a class named `WebPageText`. But this last one is strange : is it normal that this class has no package ? – Marc Le Bihan Sep 21 '18 at 09:29
  • You will need to also add Your Jars on the classpath, where are they located? The jars with the libraries You were using in eclipse? I.e. the javax.mail implementation – maslan Sep 21 '18 at 09:39
  • @Marc I bet he is using a default package for his classes – maslan Sep 21 '18 at 09:40
  • Don't post images of things that could have been posted as text. Also if you are unable to find a suitable answer, then you should provide as much information as possible so we can reproduce your problem (a [mcve]). As it stands the linked duplicate adequately answers your question, as you give us nothing specific to work with. – Mark Rotteveel Sep 21 '18 at 10:38

1 Answers1

-1

your stack trace states that class javax.mail.MessagingExceptioncannot be found. make sure you have the Java libraries on classpath that are related to mailing, e.g. https://mvnrepository.com/artifact/javax.mail/mail/1.4.7

possibly duplicate: java.lang.ClassNotFoundException: javax.mail.MessagingException