LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-29-2013, 02:02 PM   #1
ralexrdz
LQ Newbie
 
Registered: Jan 2013
Posts: 1

Rep: Reputation: Disabled
Cant run a java that sends email using mail.jar


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:

Code:
# javac -cp mail.jar myClass.java
and return no error, but...

when I try to run it like this:

Code:
java myClass
I get this error:

Code:
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

thanks! ^^
 
Old 01-30-2013, 10:17 AM   #2
YankeePride13
Member
 
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 262

Rep: Reputation: 55
is javax.mail.Authenticator in your classpath?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set mail.jar(JavaMail) and mysql-connector-java.jar in Linux class path Terry56 Linux - Software 3 01-19-2010 09:06 AM
java, .jar don't run on fedora 6 Yentor Linux - Software 1 05-27-2007 04:01 PM
How to run JAR from within Java program ?! EAD Programming 1 12-31-2006 07:11 PM
How to run a java jar file. sabliny Programming 7 11-05-2005 01:59 PM
howto run a java.jar file in FC2-3 mickeyboa Fedora 1 02-11-2005 01:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration