![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to compile and run java programs | mayahari | SUN Solaris | 3 | 03-03-2009 04:25 AM |
| how can compile cpp code containing references to java classes | surinder | High Level Programming | 1 | 10-07-2008 11:44 AM |
| Pseudo-terminal will not be allocated because stdin is not a terminal. | Shivdatta | UNIX for Advanced & Expert Users | 1 | 08-04-2008 11:29 AM |
| compile java with GUI on unix system/putty | finalight | High Level Programming | 0 | 05-22-2008 05:41 AM |
| connecting to unix through hyper terminal - as a dumb terminal | michelle | UNIX for Advanced & Expert Users | 2 | 11-05-2001 03:32 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
trying to compile and run java through the terminal
Hey everybody,
Ok here is my problem. I have this code that that compiles, but when i go to run it it gives me errors. I stored my simple java class here: /user/workspace/getMailFromSafeDoc/src I store my mail.jar file here: /user/workspace/getMailFromSafeDoc/lib/javaMail/javaMail.jar In my terminal i go to that folder and i compile it by: javac -classpath ../lib/javaMail/javaMail.jar javaMail.java ..... this works and products a class file with no errors. when i go to complile it by: java javaMail i get: Exception in thread "main" java.lang.NoClassDefFoundError: Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/NoSuchProviderException Caused by: java.lang.ClassNotFoundException: javax.mail.NoSuchProviderException 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:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336) When i take out all the try and catch, it works fine. Here is my code: Code:
import javax.mail.*;
public class getMail
{
private String userName;
private String userPassword;
private String mailServer;
public getMail(String inputUserName, String inputPassword, String inputMailServer)
{
userName = inputUserName;
userPassword = inputPassword;
mailServer =inputMailServer;
processMail(userName, userPassword, mailServer);
}
public static void main(String[] args)
{
// TODO Auto-generated method stub
//System.out.println("Hi");
getMail getSafedocMail = new getMail("dcm", "dcm01", "mail.safedoc.ie");
}
private void printData(String inputString)
{
System.out.println(inputString);
}
private void processMail(String inputUserName, String inputPassword, String inputMailServer)
{
Session session = null;
Store store = null;
printData("-------------connecting to mail-----------------");
session = Session.getDefaultInstance(System.getProperties(), null);
try
{
store = session.getStore("pop3");
}
catch (NoSuchProviderException e)
{
e.printStackTrace();
}
}
Any idea lads? |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|