Results 1 to 3 of 3
  1. #1
    bobleny's Avatar
    bobleny is offline Member
    Join Date
    Apr 2008
    Posts
    50
    Rep Power
    0

    Default [SOLVED] How do I add mail.jar to the classpath? - linux

    Hey, long time no post...

    I really need some help with this one. I am completely lost and frustrated...

    I want to send an email attachment via java. I am following this guide here which seams quite extensive.
    E-Mailing Through Java

    The problem is, I can't figure out how to use the mail.jar file.

    I'm getting stuck at the import part:
    Java Code:
    import javax.mail.*; // This equates to an error
    import javax.activation.*; // This does not
    I stored both the activation and mail files here:
    /home/bob/.java/MyJars/

    When I type in this at the command:
    export CLASSPATH=$CLASSPATH:/home/bob/.java/MyJars/mail.jar:.
    Nothing happens...

    I've tried all of these:
    export CLASSPATH=$CLASSPATH:/home/bob/.java/MyJars/mail.jar
    export CLASSPATH=$CLASSPATH:/home/bob/.java/MyJars/mail.jar.
    export CLASSPATH=$CLASSPATH:/home/bob/.java/MyJars/mail.jar:

    I also did a reboot, and it still doesn't doesn't work.

    I am running Kubuntu 8.04 - Linux

    Can any one help me?

    Thanks!
    -- www.firemelt.net --
    Cheer up, the worst has yet to come...

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    You could try

    Java Code:
    export CLASSPATH=$CLASSPATH:/home/bob/.java/MyJars/mail.jar:/home/bob/.java/MyJars/activation.jar
    Personally I specify the classpath as part of the command being used:

    Java Code:
    bob@bobz:~/.java$ javac -cp /home/bob/.java/MyJars/mail.jar:/home/bob.java.MyJars/activation.jar:etc:etc:etc Foo.java

  3. #3
    bobleny's Avatar
    bobleny is offline Member
    Join Date
    Apr 2008
    Posts
    50
    Rep Power
    0

    Default

    Hey, thank you very much!

    I figured out how to do it in netbeans, so to keep me from going insane, I did it in there and it worked great!

    I am now able to send an email with an attachment via Java!

    This does work!
    Java Code:
    export CLASSPATH=$CLASSPATH:/home/bob/.java/MyJars/mail.jar:.
    Last edited by bobleny; 04-02-2009 at 11:02 PM.
    -- www.firemelt.net --
    Cheer up, the worst has yet to come...

Similar Threads

  1. Replies: 6
    Last Post: 04-08-2009, 05:05 AM
  2. Replies: 2
    Last Post: 05-05-2008, 07:01 AM
  3. Retreiving of mail body using mail number
    By chandu.v09 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-13-2008, 03:25 PM
  4. Set classPath?
    By rgbosque in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 03:14 PM
  5. Sending a mail with the local mail program
    By thedude in forum Advanced Java
    Replies: 2
    Last Post: 07-23-2007, 01:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •