Program not behaving the same after making it a JAR

Hello,
I'm developing a program using Eclipse and wanted to export a JAR file to test out. I was able to successfully make the JAR file and it does run, but not as expected. For example, I have the following code which opens up a JFileChooser and lets the user select multiple files to be stored in a JList (via a list model). When I run this from the IDE during development, it works as it should, allowing me to select multiple files from the JFileChooser and adds all of the files to the JList. However, when I run the JAR, it lets the user select multiple files but only adds ONE file to the list. Not only that, but it doesn't seem to be running my "loadComparePaper()" method after adding the item to the list model.
JFileChooser fileChooser = new JFileChooser();  // New JFileChooser
fileChooser.setMultiSelectionEnabled( true );     // Allow multiple files to be selected
FileFilter docFilter = new ExtensionFileFilter( null, acceptableFiles );  // "acceptableFiles" is an array of allowable extensions (not shown in this snippet)
fileChooser.addChoosableFileFilter( docFilter );  // Tell the JFileChooser to use my filter
int returnValue = fileChooser.showOpenDialog( null );  // Open the dialog; store result
if ( returnValue == JFileChooser.APPROVE_OPTION ) {
    File[] selectedFiles = fileChooser.getSelectedFiles();  // Get selected files; store in array
    for ( int i = 0; i < selectedFiles.length; i++ ) {  // For each selected file..
     compareListModel.addElement( selectedFiles[ i ].getName() );  // Add file name to list -- getting stuck here!
     loadComparePaper( selectedFiles[ i ] );  // Call method to load this file (read it)
}It seems like it's not running the whole for loop, because only one item is being added to the list and it never reaches "loadComparePaper()". Again, it works during development in the IDE and I've tried exporting the JAR quite a few times to see if that was the problem, but the JAR itself is executing.
Any ideas? I'm baffled as to why it works while I'm testing it out in the IDE, but after I export the JAR it's not working properly. Do you think this has something to do with Eclipse? Has anyone else experienced a problem like this?
Thanks

ThomYork:
Thank you for the advice. I'm new to using JARs and foolishly forgot or didn't realize that I should run it from the console to check for errors. Well, it seems this is the problem: I'm using Apache's POI package and have it stored in the directory +/my_project/lib/poi/+. Within the +/poi/+ folder are 3 JAR files that my program references. When I run my app from within the IDE, I don't get any errors because I've included them in the build path. However, when I run my JAR, it can't find the classes -- it doesn't seem to be looking in the +/lib/poi/+ folder even though my JAR file is in the same root directory as the main class when I run it within the IDE (i.e., both my_main_class and my_main_jar are in the same level directory, and would need to look in the +/lib/poi/+ folder for the other packages).
So I guess my problem is... my JAR file doesn't "see" the path of the other packages I'm using. In Eclipse, I've configured my project to include these other packages in the build path (and also the "Order and Export" build path) so I thought it would include them, but that doesn't seem to be working.
Am I missing something? How do I include JARs in other packages / folders so that they work in my JAR?
Thanks again
EDIT: I see some other people on this forum experiencing similar issues and I noticed you've helped them out. I tried creating a manifest file, but that didn't work, either... just to be more specific, this is the error message I'm getting:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/poi/poifs/filesystem/POIFSFileSystem
        at OneToOne.loadSourcePaper(OneToOne.java:907)Edited by: ibanezplayer85 on Aug 14, 2008 10:19 PM

Similar Messages

  • Photos do not look the same after being uploaded to the web

    Hey,
    I have a problem with photos not looking the same as they do in LR when I upload them to the web.
    Is there a fix for this?

    >I now sometimes incorporate an "extra boost of saturation" in the
    work flow in anticipation of the loss of saturation when I take the save for web option in CS.
    >It is a bit arbitrary ... what is the view of the pros / experts on
    this remedy?
    This is a bad idea. The loss of saturation you see is only there on YOUR specific screen. It will not happen on other people's screens, except when they have a similar screen and graphic card as you. Other people might see much higher saturation on their screens. The point behind sRGB is that it provides an average target for the screen manufacturers. Screens cluster around it and so it is a REALLY bad idea to try to compensate for the problem in your specific screen. What you should do is refuse to use non-color managed webbrowsers as they will always lie to you. This means you have to use Firefox with the secret setting (see above) or Safari. If you use sRGB and a color-managed browser you will see what the average person sees. If you use sRGB and a color-dumb browser (i.e. IE) you will only see what you see.
    P.S. I am assuming you hardware calibrate your screen. This is essential. Even when calibrated, colors will only be right in color-managed apps.

  • IPhoto 08 not behaving the same in G5 and MacIntel

    Hi, I installed iPhoto 08 recently on my G5 1.6 Ghz and a new MacBook (macintel).
    I noticed 2 big differences between the macs regarding how iPhoto behaves:
    - opening (magnification of) pictures is slow and choppy on the G5
    - on the G5 too, the events don't show the small text box "Display pictures" when mouse is over an event. That implies that we can only double click the event, which opens the event the same we'd do for any album. It seems not possible to double-click and open a single picture displayed in an event frame before we open the event itself.
    I don't get where those differences come from. Is that due to the Graphic card, or also something else? Thanks for helping.

    Lukum
    opening (magnification of) pictures is slow and choppy on the G5
    This could well be due to the graphics card or video RAM that's available.
    I'm afraid I don't quite understand your other issue:
    Have you compared the Preference setting between the two machines? For instance, if at iPhoto -> Preferences -> Events, I select 'Double Click Event: Shows Photos' then I don't get the 'Display Pictures Box, but if I select 'Magnifies Photos' I do.
    Regards
    TD

  • A page does not behave the same in every case

    Hi,
    I am using adfbc and jsf/adf pages.
    I have an entity called Parish (CountryId, CityId, AreaId, ParishName), and created a simple validation method (if the parish name is equal to "test" then to show an error by returning false).
    I created a custom validation method in my AppModule that i just simply get the record id, find the entity and set the values with the method parameters
    I then created a view based on the entity and dragged my view object on my jsf page. I created a button and i binded my custom edit method to the command button, setting the appropriate parameters to bindings on the form. I then double clicked by button and created a binding for the method in a bean.
    When i edit a record and change for example the CountryId, CityId, AreaId and set the ParishName to test (so to force my validation method fire), i am shown the error but the data that i last inputed are lost, and the original are show.
    In another case where i am doing the same thing, the data are kept.
    For example, i have a record with CountryId:UK, CityId:London, AreaId:Finchley, ParishName: North Finchley and when i edit the record and define CountryId:USA, CityId:New York, AreaId:Manhattan, ParishName: test, i get the error message but the data are the original (CountryId:UK, CityId:London, AreaId:Finchley, ParishName: North Finchley). I want to keep the last entered data. In some forms this is done automatically, but in this form i didn't do anything, just dragged and defined, and is not working.
    Anyone please help?
    Antonis

    I apologize for insisting on this, but in my humble opinion it's not useful to try and figure out why your hand-written example is not working if already the declarative way is not working as we expect. We need to figure out why the declarative way is not working first.
    One of my primary jobs is helping customers use ADF correctly and understand how it works internally.
    The code in your updateParish() method is redundantly applying updates to entity attributes that ADF will already have applied to the entity for you. To see this for yourself, you can set a breakpoint in one of the setter methods of your entity object and you'll see that your code is applying the updates a second time.
    I see one reason why your error reporting won't be working as expected, which is that you are directly using the entityImpl object to apply the values. The ADF bundled exception mode only works when you use the view object row to apply the updates to the entities indirectly. Howing using the view object row to apply the values is what ADF will have already done automatically for you, so it's not necessary to do that.
    It's also not a best practice to pass a literal integer value for the first argument of setAttribute(). If for any reason the constant values change, then your code will break. You should call setAttribute("TheAttributeName",thevalue) instead for more robust code.
    Finally, your programmatically setting the user principal name and current date time can also be handled for you automatically by ADF by setting those attributes to be of the correct "History Attribute" type. See section "6.6.3.10 History Attributes" in the ADF Developer's Guide for Forms/4GL Developers on the ADF Learning Center at http://www.oracle.com/technology/products/adf/learnadf.html
    Set a breakpoint in your validation method and debug the completely declarative edit form with the simple (Commit) button. We need to understand if the:
    (a) validation is executing, failing, but the validation error is not being reported correctly, or
    (b) validation is never being enaged at all.

  • Embedded videos not behaving the same

    Hi:
    I just put some video clips on my web site. I have embedded
    them. 3 clips are similar in terms of size of file and length of
    clip. When I click them from the web site 2 of them immediately
    display the QuickTime Player with a download progress bar. The
    third one, however, just shows the big blue Q on the page until the
    entire video is downloaded then the player appears but it's about a
    35 second wait. I'm sure I handled the 3 clips the same why do they
    show up differently. I'm afraid a lot of people won't hang around
    that long not knowing what's going on.
    Any suggestions?

    NOTE that you have autoplay set to FALSE:<embed
    src="video%20clips/Soul%20Brothers%202.mov" width="185"
    height="148"
    autoplay="false"></embed> <embed
    src="video%20clips/Afrikadey%20med%20large%20copy.mov"
    width="249"
    height="197" autoplay="false"></embed>You don't have
    these coded properly
    for the ActiveX fix in Internet Explorer.

  • Terminal not Behaving the Same with Text Clippings as in 10.5

    I just upgraded to an Intel Mac from a G4 tower (very nice) and I have a lot of text clippings that I drag and drop into Terminal which now have back slashes embedded in them like this:
    while true\
    do\
    ls -ltr dx|grep "`date +%b\ %e`"\
    ls -ltr |grep "`date +%b\ %e`"\
    ping -c 1 dx1|grep "packet loss"\
    ping -c 1 dx2|grep "packet loss"\
    date\
    sleep 45\
    done\
    where do these come from and how do I get rid of them - I had to add them above so I know they aren't in the text clipping. Also I can copy inside Terminal window to window and it doesn't add them.
    Any thoughts? It's fairly annoying.

    I have several scripts that I have sitting on my desktop as text clippings that work fine in 10.5 but now that I have 10.6 (new iMac) I get these back slashes after every line. I could just as well I suppose make these things aliases or just files in Linux that I run but I've been using them as text clippings that I just dump into a terminal window and everything in the text clipping is done - now terminal is misinterpreting something. They are the same text clippings - if I use them in 10.5 that terminal has no problems - no back slashes.

  • My sound mix does not sound the same after using Compressor for DVD

    Hi,
    Is there something I can do to maintain the sound mix of my original file when converting to the dolby in Compressor. It needs to be louder overall and sometimes the music goes way too low and the dialogue goes to soft. Sound effects were louder and now get quiet during some parts.
    Help?
    Thanks!

    Hi:
    You must do some changes in the standard AC3 preset from Compressor. Duplicate it, and chage the following settings:
    - Dialog Normalization: -31
    - Compression Preset: None
    Save it and try it. You must get the same mix and level than your original.
    Hope that helps !
      Alberto

  • Firefox mouse event not behaving the same on PC and Mac computers

    I use the FCKEditor and having a very strange problem. When I click on the FCKEditor's editing area, the keyboard gets disabled untill I click the mouse somewhere outside of the editing window. The problem only happen on Firefox (3.6.10) on Mac computer (Snowleopard 10.6.4). Doing exactly the same steps on PC works without any problem.
    What I want to know:
    - Is it possible that the Firefox on Mac is different than the PC in handling mouse events? Or some other areas?

    Sounds more that Firefox is treating that editor area as read-only.
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • Safari not working the same after os 5 update, no pages show in ipad2

    After OS5 update, safari in ipad2 does not show pages of websites visited (should be up to 9) - it's now a bar at the top which I do not want. Prefer previous method. Anyway to get back to that?

    Post Author: dean handy
    CA Forum: General
    Ok, I'm going to try this as soon as I can, but that still leave the last part of my original question unanswered, "we found that the queries on the XP ws were changing equals to inner joins, we could change it back but the dates were still coming up static no matter what dates were picked in the query. example." Any suggestions with this?

  • Ipod's playlist order does not stay the same after undocking from itunes

    Hi,
    I have built several playlists on my new 6G ipod nano.  I arranged about 50 songs that I want to play at the start of the play list. They are arranged correctly while docked to itunes.  When I undock and hit <playlist> and select the playlist to start, they are no longer in the order I put them in. 
    Any help would help.
    Thanks,
    PWpw

    When I play songs in my car, it always plays in alpha order by song name. I've checked the far left "number" column and it is fine in iTunes. It seems that if I could move the "name" column, it would fix the issue. I've been reading posts for about an hour and can't find a solution. I presume my issue is the bug here. Can someone confirm this bug is still open?

  • My left shift key on Macbook Pro Retina (15") is behaving like the F11 key (show/hide open windows).  The key behaves the same for the laptop keyboard and for an external Apple keyboard?  This just started in last week after 6 months of use

    My left shift key on Macbook Pro Retina (15") is behaving like the F11 key (show/hide open windows). 
    The left shift key behaves the same on the laptop keyboard and on an external Apple keyboard. 
    This just started in last week after 6 months of use.  The right shift key and other keys on the keyboard all appear to work correctly.
    Suggestions greatly appreciated.

    I have a solution to this issue now after a discussion with Apple Support.  Some where in the last few weeks, there was a change in the key that would do a Show Desktop under the Mission Control settings in the System Preferences.  Even though the key sequence that was shown for the Show Desktop setting did not include the Left SHift key, by changing this first to having no key sequence and applying that and then changing it back to the F11 key, the Left SHift key issue that I was having has cleared up.
    A second issue that was uncovered was that the SSD had some issues (uncovered when I ran Disk Utility using the Repair Disk key).  I had to restart and use the Disk Utility through the Command R sequence to get to the stand alone Disk Utility.  The SSD appears to be running better as a result as well.
    Hope that this is of use to someone else in the future.

  • Can anyone help me with an iWeb problem? I cannot save the site after making changes. I receive this error: "website.sites2 could not be saved"

    Can anyone help me with an iWeb problem? I cannot save the site after making changes. I receive this error: "website.sites2 could not be saved"

    You could try duplicating the Domain.sites2 file and launch this in iWeb. Delete the last page you edited and try saving. If that doesn't work, undo and try deleting another and so on...
    If you can find the problem page you would only have to rebuild it rather than the whole site.
    The other possibility is to create a new site on the same domain file and drag each page in turn down to it from the top site and try to save each time.

  • I have installed iOS7 on my iPhone4. I am able to add/edit contacts by clicking the "contact" icon. But when I am trying to do the same after clicking the "phone" icon, it is not displaying the keypad. I believe it is a bug in iOS7. Please confirm. iPhone

    I have installed iOS7 on my iPhone4. I am able to add/edit contacts by clicking the "contact" icon. But when I am trying to do the same after clicking the "phone" icon, it is not displaying the keypad. I believe it is a bug in iOS7.
    Please confirm.
    iPhone 4, iOS 7

    Hello jayanand,
    You may need to force close all open apps, then restart the phone. If necessary, you may need to reset the phone after that.
    iOS: Force an app to close
    http://support.apple.com/kb/HT5137
    iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/HT1430
    Cheers,
    Allen

  • HT4623 After updating my IPAD 64 the typing has not been the same.  It takes 3 minutes to type in my password.

    After updating my IPAD 64 the typing has not been the same.  It takes 3 minutes to type in my password.  Has anyone found a repair for this?

    Reset all settings
    Settings>General>Reset>Reset All Settings

  • TS1702 I downloaded IOS6 to my ipad2..since then the Pentix Free app has not been behaving the same as before the download

    I downloaded IOS6 to my ipad2...since then the Pentix Free app. has not been been behaving the same
    Is this a problem with the upgraded IOS?

    It's more likely that the App make needs to provide and update for iOS6.

Maybe you are looking for