Im trying to run in a Linux Server with Tomcat a simple java to send emails.
I have the myClass.java and the mail.jar on a directory
I already did:
# javac -cp mail.jar myClass.java
and return no error, but...
when I try to run it like this:
# java myClass
I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Authenticator
Caused by: java.lang.ClassNotFoundException: javax.mail.Authenticator
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: myClass. Program will exit.
Its strange, beacuse I run it exactly like that on Windows and it works. I also try to do a simple class with just a System.out inside and it run,
but i dont know why im not getting the Authenticator class, if I already check that it is contain in the mail.jar
Im using java 1.6.0_22
thanks! ^^