title: Getting java.lang.ClassNotFoundException
body: <p>I am able to compile code but while running it is throughing classnotfound</p>
  
  <p><code>C:\Users\Desktop\New&gt;javac -classpath java-mail-1.4.4.jar SendMail.java</code></p>
  
  <p><code>C:\Users\Desktop\New&gt;java -classpath java-mail-1.4.4.jar SendMail</code></p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: SendMail
  Caused by: java.lang.ClassNotFoundException: SendMail
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
  Could not find the main class: SendMail.  Program will exit.
  </code></pre>
  
  <p>Can you suggest how to solve this?</p>