Packaging in JAR makes JavaMail not work

I have simple code (virtually identical to the demo code that comes with JavaMail 1.3) to send an email with an attachment that works fine until i package it in a JAR file and try and use javaw to run it. I have included the mail.jar and activation.jar files in the app JAR file with no success. Once again the code works fine outside of a JAR file.
-thanks
benji
Properties props = System.getProperties();
props.put("mail.smtp.host", server);
props.put("mail.from",from);
Session session = Session.getInstance(props, new myAuthenticator());
session.setDebug(debug);
try
MimeMessage msg = (MimeMessage)new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
MimeBodyPart mbp1 = (MimeBodyPart)new MimeBodyPart();
mbp1.setText(message);
MimeBodyPart mbp2 = new MimeBodyPart();
FileDataSource fds = new FileDataSource(sendFile);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
msg.setContent(mp);
msg.setSentDate(new Date());
Transport.send(msg);
return true;
catch statements

Correct, a JAR Executable, no i did not enter the mail.jar and activation.jar as "Class Path" files in the app jar. i used the following command:
C:\j2sdk_nb\j2sdk1.4.2\bin\jar vcm0f mainClass4.txt ZipperS.jar C:\javamail-1_3_1\mail.jar C:\jaf-1_0_2\activation.jar ZipperS.class (more classes)
where the file mainClass4.txt contains:
Main-Class: ZipperS
How do you specify mail.jar and activation.jar as class path entries?
thanks

Similar Messages

  • My i phone got stolen.. can you help me to make it not working ?

    hello
    my cell phone got stolen then i want to make it not working so that it dose not beneft the thief.
    can you help me , pls?

    No. If you set up the "Find my iPhone" service on the phone before it went missing, log on to http://www.icloud.com. If it's still online and hasn't been wiped yet, you can lock it, wipe it, trace it's location, from there.
    There is no other way to do it.
    Report the theft to your carrier and the police.

  • Hi the wifi when make update not works good

    hi
    the wifi when make update not working good
    now i cannot turn on wifi the wifi button
    can you help me please ????

    Hello Riham123,
    Thank you for using Apple Support Communities.
    It sounds like the wifi button is grayed out and you are unable to toggle it.
    I recommend trying the steps in this article:
    iOS: Wi-Fi settings grayed out or dim
    http://support.apple.com/kb/ts1559
    Verify that airplane mode is off by tapping Settings > Airplane Mode.
    Reset the network settings by tapping Settings > General > Reset > Reset Network Settings.
    Note: This will reset all network settings, including Bluetooth pairing records, Wi-Fi passwords, VPN, and APN settings.
    Ensure that your device is using the latest software. To do so, connect your device to your computer and check for updates in iTunes.
    If your issue is still unresolved, perform a software restore in iTunes.
    All the best,
    Sterling

  • Jar file is not working after deleting all packages from the same directory

    hello
    i have created a jar file named as server.jar in the same directory in which i have all the packages(for which i have created this jar file).This jar file was working correctly when i had all the packages in the same directory.But after deleting all the packages from the same working directory, this jar file is neither working nor giving any error message..
    Please tell me what may be the reason???
    thanks in advanced

    hello
    i have created a jar file named as server.jar in the same directory in which i have all the packages(for which i have created this jar file).This jar file was working correctly when i had all the packages in the same directory.But after deleting all the packages from the same working directory, this jar file is neither working nor giving any error message..
    Please tell me what may be the reason???
    thanks in advanced

  • .jar file is not working properly :developed in NETBEANS

    Hi Gurus,
    i am using NETBEANS IDE 7.2.
    i am developing a project that interacts with databases 10g and COM ports of machine , these all processes are performed by .bat file which i am trying to run from jFramform , code works perfectly .bat file is also called perfectly when i run the project using F6 from the NETBEANS, for testing i placed some dialogue boxes on the form to test it ,
    but when i run executable .jar  file , form run successfully and dialogue box works perfectly but .bat file is not called by executable .jar file.
    this is how i call the .bat file...
      String filePath = "D:/pms/Libraries/portlib.bat";  
            try { 
              Process p = Runtime.getRuntime().exec(filePath); 
            } catch (Exception e) { 
                e.printStackTrace(); 
    and below is the contents of portlib.bat file
    java -jar "D:\SMS\SMS\dist\SMS.jar" 
    you must probably ask why i am calling a .jar file using .bat file .
    reason is that this .jar project sends message using GSM mobile , System.exit(); is compulsory to complete a job and then do the next one ,
    if i use the same file to execute this job it makes exit to entire the application (hope you can understand my logic).
    that's why i use extra .jar file in .bat file , when single job is completed .bat exits itself and new command is given.
    Problem is that code is working perfectly in NETBEANS when i run the project but when i run .jar then .bat file is not working  ,
    thanks.

    Thanks Sir ,
    You need to first test an example that works like the one in the article.
    There are plenty of other examples on the web - find one you like:
    http://javapapers.com/core-java/os-processes-using-java-processbuilder/
    I tried this one.
      try {
                ProcessBuilder dirProcess = new ProcessBuilder("D:/SMS/SMS/Send_message.bat");
                 File commands = new File("D:/SMS/SMS/Send_message.bat");
                 File dirOut = new File("C:/process/out.txt");
                 File dirErr = new File("C:/process/err.txt");
               dirProcess.redirectInput(commands);
                 dirProcess.redirectOutput(dirOut);
               dirProcess.redirectError(dirErr);
                 dirProcess.start();
            } catch (IOException ex) {
                Logger.getLogger(mainform.class.getName()).log(Level.SEVERE, null, ex);
    as instructed in the article i compiled  both the projects at same version or sources and libraries which is 1.7
    here is my version details
    C:\>javac -version
    javac 1.7.0_07
    C:\>java -version
    java version "1.7.0_07"
    Java(TM) SE Runtime Environment (build 1.7.0_07-b11)
    Java HotSpot(TM) Client VM (build 23.3-b01, mixed mode, sharing)
    inside the NETBEANS IDE c:\process\err.txt  remains empty and code works perfectly , but when I run executable .jar file( by double clicking on that file in dist directry) then c:\process\err.txt becomes full with this error text and there is no response from calling D:\SMS\SMS\send_message.bat
    here is the error text
    java.lang.UnsupportedClassVersionError: sms/SMSMAIN (Unsupported major.minor version 51.0)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Exception in thread "main"
    here is /SMS/SMS
    unknown source ?

  • Jar file is not working

    Hi,
    I have an Applet packed in a JAR file. It works very well in my local site, but when I upload it to internet it throws a java.lang.ClassNotFoundException: nibbly
    Of course I've checked names, cases, files are in the same directory.
    The html code is very simple:
    <APPLET ARCHIVE="nibbly.jar" CODE="nibbly.class"
    WIDTH=402 HEIGHT=350>
    </APPLET>
    Any help or advice would be appreciated.
    Thank you

    you can see the error in
    www.magnino.terra.cl/arch/nibbly.html
    I will check the "binary mode" of my FTP
    the nibbly.jar is in the same directory of the nibbly.html page
    thank you
    Luis

  • Trying to use ord.jdom package with a jar - it's not working...

    Guys, I'm trying to build a Swing app that uses jdom classes and interfaces. I built the app in NetBeans, and to get the jdom packages to work, I had to mount the jdom.jar. Then suddenly, I had no errors using the jdom classes Document, Element, SAXBuilder etc. I have the program running perfectly inside the netbeans interface.
    Now, how do I get everything working together in a JAR?
    Here's the starts of the respective files:
    * CTATool.java
    * Created on January 3, 2004, 1:23 PM
    package CTATool;
    * @author  jason_michael_trk
    public class CTATool extends javax.swing.JFrame
        /** Creates new form CTATool */
        public CTATool()
            initComponents();...
    * FileWriterXML.java
    * Created on March 5, 2004, 10:06 AM
    package CTATool;
    import org.jdom.*;
    import org.jdom.output.*;
    import java.io.*;
    * @author  Jason L Michael
    public class FileWriterXML
        private Document doc;
        private FileWriter fw;
        private File f;
    I need to include in the JAR the org.jdom package. How do I do this?
    Here's the manifest I am using cirrently:
    Manifest-Version: 1.0
    Created-By: NetBeans IDE
    Specified-By: CTATool.V2.jarContent
    Main-Class: CTATool.CTAToolThe jar includes the CTATool.class file, the FileWriterXML.class file and the jdom.jar.
    I'm getting the following errors, when I attempt to execute the CTATool.V2.jar:
    java.lang.NoClassDefFoundError: org/jdom/JDOMException
            at CTATool.CTATool.saveStatsAndExit(CTATool.java:1457)
            at CTATool.CTATool.quitMenuItemActionPerformed(CTATool.java:1450)
            at CTATool.CTATool.access$400(CTATool.java:13)
            at CTATool.CTATool$5.actionPerformed(CTATool.java:157)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
            at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
            at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
            at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)
            at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)
            at java.awt.Component.processMouseEvent(Component.java:5134)
            at java.awt.Component.processEvent(Component.java:4931)
            at java.awt.Container.processEvent(Container.java:1566)
            at java.awt.Component.dispatchEventImpl(Component.java:3639)
            at java.awt.Container.dispatchEventImpl(Container.java:1623)
            at java.awt.Component.dispatchEvent(Component.java:3480)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
            at java.awt.Container.dispatchEventImpl(Container.java:1609)
            at java.awt.Window.dispatchEventImpl(Window.java:1590)
            at java.awt.Component.dispatchEvent(Component.java:3480)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)this is right when the FileWriterXML class is created and ran.
    Help??!??Thanks in advance!
    chewy

    I think I figured this out, if it helps anyone...
    You have to wrap up all of YOUR classes into a jar, and have a manifest entry that specifies:
    Class-Path: jdom.jar
    Next, you have to put the two together (I used a self-extracting zip file. It contained MyApp.jar and jdom.jar).
    when the client extracts it onto their desktop and double clicks on MyApp.jar, it works perfectly.
    I don't think there's an easy way to package the jdom.jar in my jar and make this work.
    Hope this helps some other wary traveler!
    chewy

  • .jar file suddenly not working

    I have some minimal experience working with .jar files, but I am baffled here.
    Recently, the jar file for one of my programs stopped working. I had just made a change to my main class, so i repackaged the jar. Now it says "Can't find main class" when I try to run it. It will only work if I add the line
    Class-Path: . (there is a period there)
    to my manifest.
    This would be fine, but I want to use exe4j to make it into a Windows executable. exe4j must do something where it does not honor the mainifest settings, because the executable gives out a "can't find main class" error no matter what.
    What has happened? It is only an issue with this program, i have repackaged several others to test, and they work without the "Class-Path" workaround. I'm pretty sure that it's not something in the nature of the program itself, because it worked eariler, and my only change was a small one (the text of a few JLabels).
    I have made sure that my main class is in the root of my jar file, and I have the Main-Class attribute correctly set in my manifest. The program runs fine outside the jar, but displays this odd behavior only when "jarred".
    Any help would be greatly appreciated.

    also, it's only the one class that's affected.
    I tried setting the Main-Class to other classes in the jar, and that worked fine. When I tried to make a workaround, making one of the other classes' main call the one I wanted, i got a "fatal exception" error. I'm pretty sure it still couldn't find the file.

  • My JAR file is not working properly!!!

    Hi everyone,
    I made an application that has a GUI (window). I converted it into a JAR file so I can send it to a friend by email. Then she can run it to generate the output. First, the user has to select a destination to save the .txt file (using JFileChooser). Then enters the inputs (using JTextFields). Clicks "Run" button (Results will be calculated and copied to the file). A Message will appear indicating that the results are copied. The problem is that when I run the application in the IDE (Eclipse) it works fine. But when I convert it into JAR, The moment I click the "Run" button, suddenly the window closes. Please HELP???
    Thank you

    DrClap wrote:
    Eng.Sh_2004 wrote:
    Sorry guys, but i would like to make things clearer, As I mentioned earlier, What i'm doing is the following: 1) Using the Jfilechooser, save the results into a filename.txt file _[main class in the manifest file (class for the GUI) ]._ 2) Click "run" to write the data to the created file in step 1 [_another class is used to write to file_]. I have a feeling that the problem is related to the manifest main class. What do you think guys?I think your description of the problem is very bad. And I think your idea of making wild guesses is a bad way of diagnosing problems.
    First of all. A JFileChooser does not save anything. It just allows the user to select a file to be saved to. So if you thought that the first step was writing anything or creating any file, you're probably wrong. But examining the code would help you understand.
    Second, if you're having problems because one class chooses the file name and a second class writes data to it, then you're probably running into the basic beginner problem we see around here all the time of how to communicate data between objects. Again, examining the code might help.
    Third, you need to understand what is writing that error message. Examining the code would help there too.
    So: stop guessing. Look at the code.I'm still New To Java that's why i find difficulty in problems diagnosis. Regarding the JAR problem, as you mentioned, I used JFileChooser to select a file and (copying data) is the other part. So I will look at the code again.
    Edited by: Eng.Sh_2004 on Aug 26, 2010 1:10 PM

  • Help -- Trying to create JAR file but not working

    Hi everyone
    I have created a rather noddy Java program that consists of 4 JComboBox's and 1 JButton on a JFrame.
    When the button is clicked a text file is generate with the options that have been selected.
    There are severial files that the program uses for this:
    gcc.java
    OutToFile.java
    gccConfirm.java
    MyNewWindow.java
    main.java
    I am using Jcreator and so must use the command line to create the Jar file.
    I have never done a jar file before so I did an example with a hello world program and got it working now problem. I did the same for this program and the JAR file is generated without error. I double click on the JAR file to run the application, but nothing happens. I can see the application running in memory but nothing loads on the screen. However if I run it from the command line using Java -jar gcc.jar then everything is ok.
    can anyone help me here?
    thanks in advance

    If you run you .jar from the command line (a shell in unix speak) there
    already is a console where your java program can send it's System.out
    stuff. Right click on your .jar and select 'properties' (or similar). Note
    that your .jar is run by 'javaw'. This executable is similar to the 'java'
    executable except that it doesn't open a console for you. Change the
    'javaw' command to 'java' and voila, there's your console again.
    kind regards,
    Jos

  • Any changes in workgroup manager I make are not working!

    First off I know this isn't the place to vent, but I am so sick of all the bugs loaded in the directory system of mac. I think Apple has produced a horrible product and it is always one problem after another. I am experienced with all the other directory systems and I firmly believe Open Directory is the worst!
    Ok, now on to my problem. Our set up includes 6 Mac OS X 10.6 servers. 1 is the Master OD and the others are all replicas. We recently upgrades the servers from 10.5 and ever since I have been having problems with OD. During the upgrades I took an archive of the system, decommissioned the Master and all replicas, then after the upgrade I restored the archive and replicated all the others. Things worked fine for a couple of days. Everyone can login and I could create new users and make changes in workgroup manager. After a couple of days I could no longer make any changes in workgroup manager. I can physically make the changes and create new users and save with no errors, but when I try to log into the file server with the new user or use the changed password, it doesn't work. No errors in the logs that I looked in.
    Here is something weird: When I log into workgroup manager using the local administrator account, I do not see the changes I made in workgroup manager. When I click the unlock button and log in as the diradmin I can see the changes.
    Any, ANY, help would be greatly appreciated. I've been working on this for weeks now. Please don't advise to decommission the Master and rebuild the directory. I already tried that about 10 times with the same result.
    Thanks!

    5 days should be plenty, unless you have a really slow link. Here are a few diagnostics that come to mind to figure out more about what's going on:
    To test to figure out of I'm right about replication being the source of the problem, and if so which replicas aren't up to date, use the "ldapsearch" command to compare the data in the master vs. the various replicas. For instance, to check whether a new user named "fred" has shown up in the server at serverIP, run the command: ldapsearch –LLL –x –h serverIP –b cn=users,dc=masterserver,dc=example,dc=com “(uid=fred)”
    (replace serverIP with your server's address, "dc=masterserver,dc=example,dc=com" with your search base, and fred with the actual account name). Try this on the master and the various replicas, and see which (if any) of the replicas are out of sync.
    If some/all of the replicas are out of sync, check /var/log/slapd.log on the problematic replica(s). It's visible in Server Admin -> servername > Open Directory in sidebar -> Logs in toolbar -> LDAP Log in the View pop-up at the bottom of the window.
    Also, check the replica status in Server Admin -> Open Directory -> Settings -> General.
    Also, on the problematic replica(s), check the replication connections: "sudo lsof -i | grep ldap" should show an entry starting with "slapd" and ending "->masterserver.example.com:ldap (ESTABLISHED)". If it doesn't, you may have some sort of network connectivity/firewall issue.
    If you want to get even more detailed, running "sudo tcpdump host masterserver.example.com and port ldap" on the replica will let you spy on the content of the replication connection.

  • Final Cut Server Make Link Not working. And I could almost swear this wrkd

    I am trying to create a link to a new primary representation of an asset ( I am using a script to move it due to space constraints) and I cannot relink to the new file with:
    sudo ./fcsvr_client make_link --llinktype 2 /asset/4387 /dev/19/Set%20Test%201.mov
    CODE = E_DATABASE, DESC = ERROR: null value in column "childentityid" violates not-null constraint, SRC_FILE = PmsTask_Db.C, SRC_LINE = 295
    I cannot create a link of ANY type.. Even if I try a link type of 15 for edit proxy it wont complete... Now here is something interesting thought.. I one time accidentally hot the return key before I had completed type out the movie name and it created a link to /dev/19 successfully .. Of course that doesn't work because it is a device not a movie...
    Anyone have any suggestions?
    Thanks

    Hi -
    I have recently dealt with this issue - the command line error is because FCS is trying to "make" the link, but cannot link to a file that is not already associated with some kind of Final Cut Server "entity", be it on the parent side of the link, or child side.
    I would ask, if you're replacing one primary rep with another, why you can't simply replace the file on the device, with the exact same filename?
    At any rate, if you need to run make_link, you'll need to have the file associated with an FCS entity already, before running make_link. For some proxies in our workflows, this is accomplished by creating a "proxy" asset to be the entity in question, and then running make_link as you described.
    I hope that helps!
    - James Heliker

  • Shortcut on Quiz Submit button make "click" not work! CP8 - HELP

    Can someone help me out here?
    Okay, I have a few quiz questions. If I have not shortcut on the submit button, it works just fine. If I put "Enter" on the submit button, I cannot click it. Yes, Allow Mouse Clicks is checked.
    I would like my users to be able to press enter or click.
    Running cp8 on win 8.1. Tried in preview mode, as well as published in IE and Chrome.
    Feels like I'm losing my mind! I have also tried with accessibility enabled and not. Not that it should make a difference, but I tried it.
    Thanks for any insight gang,
    Lori

    Looks like I have fallen victim to the transparent button again.  When I switch the quiz buttons to text or image, the shortcuts on them work just fine. Then they are transparent I have issues.  The nice thing about transparent is that you can color them. Because you can't use smartshapes as actual quiz buttons (submit, etc) at least not that I'm aware of, I have had to place a smart shape on the masterslide and overlay a text button with "make transparent" selected on top to make my buttons look AND behave correctly. Adobe is now aware of the issue.
    -- Lori

  • "make install" not working

    Whenever i build some program that uses autotools (./configure, make, make install), it compiles fine (after i satisfy dependencies of course) and running make install (as root) succeeds, the program is not available to me. I've tried this with a multitude of programs and i run "sudo ldconfig" after the make install and...nothing, it seems the only way to get these programs to install is to quickly create a PKGBUILD for them, but that's a bit too much work for something i want to test our real quick or something for personal use only. Also, it seems that this does not happen on the one application i tried that uses python and setuptools for build/install.
    Any help would be appreciated.
    JD

    jdhore wrote:that's a bit too much work for something i want to test our real quick or something for personal use only.
    Depends on the user. I'm so used to doing PKGBUILDS at this stage that it's easier for me to do it that way. I find the advantages far outweigh the trivial amount of work involved.
    Each to their own, though.

  • Executing jar file does not work

    i am using net beans 4.1, jdk 1.4.2_09 and jre 5.0 update 4.
    i create a jar in netbeans, exit netbeans, go to the directory where the jar has been placed and double click the jar file to run it. when i do so i get an hour glass momentarily and then nothing. the program does not execute. i hope i am not missing something very basic here. i assume i can run the program by double clicking the jar file ....
    i have checked in netbeans to insure that all classes are in the jar, the manifest looks good, etc, etc. it looks like all the pieces of the jar are in place but the program will not run. please help.
    thanks,
    dave ...

    Directory of C:\JAVA\PROJECTS\DIST
    10/04/2005 10:09 AM <DIR> .
    10/04/2005 10:09 AM <DIR> ..
    10/04/2005 10:09 AM 25,203 gift_email.jar
    1 File(s) 25,203 bytes
    2 Dir(s) 124,456,144,896 bytes free
    C:\JAVA\PROJECTS\DIST>echo %CLASSPATH%
    c:\java\projects\dist;c:\Program Files\netbeans-4.1\ide5\modules\ext
    C:\JAVA\PROJECTS\DIST>java -jar gift_email.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout
    at giftrecpt.email.gift_email_gui.initComponents(gift_email_gui.java:38)
    at giftrecpt.email.gift_email_gui.<init>(gift_email_gui.java:24)
    at giftrecpt.email.gift_email_gui.main(gift_email_gui.java:142)
    C:\JAVA\PROJECTS\DIST>
    i added the location of the absolutelayout method to the classpath but still get the error. i also included this same reference in netbeans to the project under run-time libraries. so it seems that i have added the necesary references but still no luck. what could i be missing? the manifest makes no mention of class path. here it is below:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.2
    Created-By: 1.4.2_09-b05 (Sun Microsystems Inc.)
    Main-Class: giftrecpt.email.gift_email_gui
    X-COMMENT: Main-Class will be added automatically by build
    thanks,
    dave ...

Maybe you are looking for