The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-06-2009
killesk killesk is offline
Registered User
  
 

Join Date: May 2009
Posts: 2
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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0