Netbeans can, jar can not - NoClassDefFoundError: javax/mail/Address

I have made a simple java application to send out emails. It works on Netbeans. That is, after compilation on Netbeans, and then run it on Netbeans, the email can be sent out successfully.
But after I made a jar file with cmd.exe, and then try to run it on cmd.exe, it throws the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Address
Can anyone help to illumine?
thanks a lot!

I did, doesnt work. program only works if I run jar file from location where netbeans puts jar for distribution. If I copy the jar file from the dist to the directory I want to run the jar file, it cant find the other jar i want to include.
I have my program which compiles to a jar for distribution. In netbeans i point to a sqljdbc.jar for connecting to SQL Server. Running it from netbeans works fine. Copying the lib directory in the dist directory together with the jar to my destination where I want to run the program works fine too. But I would like to link to the sqljdbc.jar at its original location.
I have added C:\applibs\sqljdbc.jar to the path in Start >> My Computer >> Properties >> Advanced >> Environment Variables. Doesnt Work.
If I copy C:\dev\myapp\dist\myapp.jar to C:\apps\myapp.jar without copying C:\dev\myapp\lib to teh same location as well, it doesnt run. It gives the NoClassDefinationError when run at the command prompt
C:\apps>java -jar myapp.jar
I even tried
C:\apps>java -classpath .;C:\C:\applibs\sqljdbc.jar -jar myapp.jar
Its like the -classpath flag is being ignored. So obviously there is a concept I am misunderstanding. I read somewhere that I have to build my own jar file. Is that the only option? Should this theoretically be working? Can you just copy the jar file from the dist directory to run somewhere else provided the libs it uses is in the path at an OS level?

Similar Messages

  • When I updated to OS 5.0 my old apple id which was not an e-mail address won't work anymore, how can I fix this?

    When I updated to OS 5.0 my old apple id which was not an e-mail address won't work anymore, how can I fix this?

    There is no way to consolidate iTunes accounts.
    Setting up an iPhone has never required creation of a new Apple ID.
    You've apparently purchased content with both Apple ID's.  Sign into the device with the correct Apple ID and sync the content.

  • TS3276 Why can i suddenly not send out mail using mail through my ntlworld account

    Why can I suddenly not send out mail using Apples Mail. My mail server is Ntlworld. I can send mail by going to Safari and loging into my mail account, but i would prefer to continue using Apples mail and my address book. Does anyone know what my problem could be. I haven't altered any settings.

    Why can I suddenly not send out mail using Apples Mail. My mail server is Ntlworld. I can send mail by going to Safari and loging into my mail account, but i would prefer to continue using Apples mail and my address book. Does anyone know what my problem could be. I haven't altered any settings.

  • Java.lang.NoClassDefFoundError: javax/mail/Service

    Hi,
    Happy New Year Everyone! Sadly, it's not that happy for me right now, I'm trying to write a mail app using JavaMail, but I'm getting a NoClassDefFoundError when I run the program.... The program compiles fine, it only crashes when I run the program. Does anyone have any ideas why that's happenning? I compile the program using javac -classpath .:mail.jar *.java and I'm working on a Unix Box. Any help anyone can provide is greatly appreciated!
    The error message I received is pasted below (I left out the stack trace to make reading easier).
    Exception occurred during event dispatching:
    java.lang.NoClassDefFoundError: javax/mail/Service
    [Stack Trace]
    Thanks in Advance!
    Juivette

    Read the directions that came with the javamail API...it tells you the OTHER API you need. Also, word of advice....I un jar'd and re-jar'd all the classes from BOTH API's in one file...makes life easier.

  • How can you use the same e-mail address for multiple ipads?

    I have two iPads.. an iPad and an ipad 2.  I registared my new ipad 2 and now my old ipad is will not let me log on and is telling me that my e-mail address is already in use.  how can you use the same e-mail address for multiple ipads?

    And by using the same Apple ID you can also share purchases.  If you have a different Apple ID for each iPhone then you can't share purchases.

  • Can I use my existing E-mail address to retrieve my password reset through security questions

    Can I use my existing E-mail address to retrieve my password reset through security questions instead of through E-mail. When I try retrieving my new Apple password through reset through security questions?  On the Apple id, it will not allow me to do so becasue I forgot my security answers to the question. I'm naming one or two of the wrong vechiles which is what the questions ask me for for security questions.
    For icloud do you reccommend that I keep that same E-mail address or create a new one for my iCloud mail aside from my G-mail address name?
    I asked support community for the very first time to reset my security questions and it wanted me to create a new user name for iCloud when I already have *****l for my original Apple id.
    <Email Edited By Host>

    TheresaEW,
    I’d recommend contacting Apple directly to resolve your security question issue.

  • How can I restore my icloud e-mail address?

    How can I restore my iCloud e-mail address?

    You can't change and iCloud email account address once created.  You can either create a new iCloud account, or add an @icloud.com email alias address to the existing account, which will receive email in your existing iCloud inbox (more details here: http://help.apple.com/icloud/#/mm6b1a490a.
    If you would rather create a new account and keep your data, start by saving any photo stream photos on your phone that you want to keep to your camera roll (unless already there) by opening your my photo stream album, tapping Select, tapping the photos, tap the share icon (box with upward facing arrow), then tapping Save to Camera Roll.  If you are syncing notes with iCloud that you want to keep, you'll need to open each of your notes and email them to yourself so you can later copy and paste the text into new notes created in your new account.  Then go to Settings>iCloud, tap Delete Account, provide the password to turn off Find My iPhone and choose Keep on My iPhone when prompted.  Then sign back in with a different Apple ID to create your new account and choose Merge to upload your data.  When you turn Mail on you will be asked to create your new iCloud email address.  Type carefully as it cannot be changed later.

  • How can I create a new E-mail address for the Marketing Manager

    Hullo,
    how can I create a new E-mail address for the Marketing Manager (i.e. marketing professional role in SAP CRM) please.
    That when you go and create a new E-mail campaign you need to choose an E-mail form in addition to the E-mail address of the Marketing Manager.
    Kind Regards.

    Hi Alhussien
    Add it to his Position in the Organisational Model. Transaction PPOMA_CRM.
    Under there address section is an option to populate the email address.
    Regards
    Arden

  • TS1645 I want to change my ID and when I try to it says that that e-mail cannot be used for my id because it is my "rescue" email address. How can I change my "rescue" e-mail address?

    I want to change my ID and when I try to it says that that e-mail cannot be used for my id because it is my "rescue" email address. How can I change my "rescue" e-mail address?

    Go to My Apple ID (appleid.apple.com), click "Manage your Apple ID," and sign in.
    With the Name, ID, and Email Address drawer selected, click Edit next to Apple ID and Primary Email Address.
    Enter your new email address.
    Click on Password and Security;
    Answer the security question;
    Delete your email from rescue address;
    Do logout and login again into manage your apple id;
    Go back to Name, id and email address;
    Change your primary email address;
    Verify your email address.

  • HT5621 how can I delete a primary e-mail addresse and replace it with a excisting Apple ID?

    How can I delete a primary e-mail address and replace it with a excisting Apple ID?

    An email address can only be used one account at a time, so if you want to replace it with an email address that is currently being used on another account then you will need to remove it from that account first before trying to put it on that account. You should be able to change the email address either by logging into your account on your computer's iTunes via the Store > View Account menu option, or via http://appleid.apple.com

  • HT201363 can I enter a rescue e-mail address to an existing account ?

    Can I enter a rescue e-mail address to an existing account ? so I can reset the security questions

    Not after forgetting the answers. You need to ask Apple to reset your security questions; ways of contacting them include phoning AppleCare and asking for the Account Security team, clicking here and picking a method for your country, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (104069)

  • Why can someone use same icloud e-mail address as mine?

    Why can someone use same icloud e-mail address as mine?
    I Have found that the new facebook account has been set up in someone's name using my iclound e-mail.

    Do a backup.
    Try System Preferences/iCloud and sign out. Then sign in with your new Apple ID.

  • HT201342 Can I change my icloud e-mail address?

    Can I change my icloud e-mail address?

    No, only by signing up for a completely new iCloud account.
    You can add an email alias to your existing account though.
    See: http://help.apple.com/icloud/#mm6b1a490a

  • Failed to  load javax.mail.Address class

    Hi,
    We are using NAS 4.0 sp 6 on solaris 8. I have noticed
    time and again on restarting NAS, the kjs engine is not able to load the javax.mail.Address class. This happens not every time but every now and then. What
    could be the reason for this ?
    Thanks for any help,
    Amit

    Has anybody an idea about this issue?

  • Can send but not receive in Mail

    I can't send out email in Mail, despite having the right settings. (I have gone over this with support.) I have used Mail for years, and this has only been a problem since upgrading to Leopard. Saw Pascal's answer to zfalstaf on Jan 7 and tried all his suggestions but nothing helps. Erased my account and reinstalled it. No good. The same settings work in Thunderbird.
    Error message: Cannot send message using (Mailbox name) Out
    +OK X1 NT-POP3 Server (URL Name Here).com (IMail 9.10 750087-2)
    Connection doctor sometimes connects to POP Mail server In, sometimes doesn't. Always gives red light on SMTP server.
    Help!
    Message was edited by: steviesaf

    Thanks for the quick reply, Pascal!
    I posted the error message above, if that helps. Maybe it just confuses the matter more...
    I have just the one email account. I only use my Mac at home.
    Your reply in the post to zfalstaf:
    http://discussions.apple.com/thread.jspa?threadID=1329221&tstart=105
    1) quit mail, launch again
    2) shut down mac, the launch again
    3) go to mail>preferences>accounts and in the account information pane, click on the smtp drop down menu and select the smtp info for that account, then in both account information and advanced delete the info and enter again and save
    4) go to same location as 3) above, and try different ports, such as 587, 465... does switching ssl do anything?
    5) go to your keychain access app and look for the password used for that account, is everything all right? maybe delete and save another one, or maybe there are more than one thereby confusing mail.app
    6) repair permissions in applications>utilities>disk utility
    7) delete that account, go to keychain and delete that password, then create from scratch
    (Me again: I have done these, and they have not helped. Hope you have some other thoughts. Thanks!)

Maybe you are looking for