How do you find a filechooser file's absolute path ?

Hi everyone,
I'm a little confused. I'm using a filechooser in my GUI to get two files. I then pass their names to another class where I am attempting to read them. When I choose testfile1 from C:\My Documents And Settings\ Danielle \ My Documents \ testfile1.txt, and pass it's name to the other class, the call: file1.getAbsolutePath() returns the path C:\projects\testfile1.txt. (Obviously I've assigned the String file1 to testfile1.txt).
I'm running into problems because of this-- according to FileReader, my testfile1.txt doesn't exist (unsurprising- Java isn't looking in the right place).
So, how do I get the filechooser to pass the correct absolute path so that FileReader has something to work with?
Thanks,
Danielle
Message was edited by:
cdelmio

getSelectedFile returns a File object. The File object contains methods to get the fully-qualified path (getAbsolutePath() I believe). Presumably you are invoking some other method (getName() I assume) which returns the file name only, and so you have thrown away that valuable piece of information.

Similar Messages

  • How do you find a deleted file with doing a recovery? Windows 8.1

    I have a new 8.1 Windows laptop and inadvertantly deleted a document, how can I retrieve it?

    Have you checked in the Recycle Bin?
    You can also try File History:
    http://windows.microsoft.com/en-us/windows-8/how-use-file-history
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • How to get InputStream from a file with absolute path?

    Hi, guys:
    If I have file with a absolute path that may be inside/outside
    my Eclipse plugin, I want to get an InputStream from it. It just keeps giving me null for "is":
    String absFilePath = "/D:/my_dir/.../sample_file.txt";
    InputStream is = getClass().getResourceAsStream(absFilePath);
    regards,

    Don't use resource as stream if you have an absolute path, use FileInputStream.

  • How do you find multiple original files in itunes? Many threads no answer

    I tried looking through a lot of topics that had similar problems but haven't run across an answer yet. I am trying to locate original files for itunes. The library is directed to an external HD. The files are in the HD and I can 'find' them one at a time. As with others on this forum, I don't want to do it individually. Any one know an easy way to point to the music folder for all the titles?.
    I actually have the whole library on a travel drive as well and it seems to find them there. If the travel drive is unplugged, then it cannot find the original. I'm guessing that there is a path that needs to be followed and yet in the advanced prefs it is pointing correctly.

    *Don't move any media* until your library is working reliably.
    My experience is that you can move the "library" files (outside the red box) anywhere and provided the "content" (inside the red box) stays put iTunes will find the files. You can also move the library as a whole, "library" & "content", when nested as shown. Typically when people run out of room they follow a guide which explains how to relocate the content only using iTunes to manage the shift. This has two drawbacks, first iTunes can sometimes fail to complete the operation leading to an unstable library and second it complicates things when unxpected system changes occur.
    You might find your existing library and content will reconnect if you edit the location of the iTunes Media folder in preferences to the current location, close iTunes and reopen.
    iTunes 9 will work perfectly well with files in the older layout. If you "upgrade" to *iTunes Media Organisation* it should reorgainse the files, but similar caveats obtain. If iTunes crashes while moving the files about (as has heppened to others posting here) then repairing things is complicated. The automated process also fails to rename *iTunes Music* to *iTunes Media*
    Again, from my own tests and when properly nested, iTunes will accept the renaming of the *iTunes Music* folder as *iTunes Media* and update the iTunes Media folder preference automatically. If that works and you then close & reopen iTunes and everything still works normally, you can try pushing an Artist folder into iTunes\Media\Music. I think it works, but I manage the structures inside iTunes Media manually & I don't have time to test it just now. If iTunes doesn't llike any step you take just put things back where the were. You can always let iTunes manage the iTunes Media Organsiation upgrade if you have a decent backup and can restore.
    tt2

  • How do you Find a Specific File in Joomla with CS5 ?

    Yes ! I have Joomla working inside DW CS5 !!! 
    The mistake which I and maybe everyone else seems to make is that during site creation I would have my local site and testing server being different. If you make them the same DW finds your dynamic pages in Joomla !
    Great - I now see the 300 or so files in my Joomla site.
    Problem: I want to change an embedded in line style on my page which Joomla has created for me.  How in the heck from the 300 files, can I find the 1 php file which contains this 1 element style ?
    any Ideas ?
    Many thanks Vincej

    Maybe ctrl+F -> Search in the entire site -> Code view
    and search for example: style="the inline style;"
    That could be a solution...
    Cheers!

  • How do you find out which files are not authorized?

    All of a sudden, out of the blue, I start getting this message :
    Some of the Audible files in the iTunes library were not copied to the iPod “iPod” because you are not authorized to play them on this computer.
    Well first of all - all of the music I've bought in the last 4 years have come from iTunes so why this comes up now all of a sudden is beyond me.
    Computer hasn't changed.
    Same old iPod touch (1st gen) I've been using for several years now. The last time I tried to sync it was probably a few weeks ago (with no problems).
    I thought I'd look to see if say the past 10 songs I've purchased are on the iPod (which goes back several months)... they are.
    So I thought - ok let's see if I get a problem syncing my iPhone and my iPad. Nope - no problems there.
    I'm stumped.
    It would be nice if I could even get a list of the files it claims can't be synced to the iPod, that would be a good starting point to diagnose the problem, but I can't figure out even how to get that.
    Help!

    PunkStar Studios wrote:
    Some of the Audible files ...
    if you're seeing that error, it has nothing to do with purchased content from the iTunes store.
    Audible is an online store that sells Audiobooks. The audiobooks purchased from Audibooks work the same way as the songs purchased from iTunes. You can only play the audiobooks on a limited number of computers.

  • In "About This Mac, on OSX MAVERICKS, under "Storage" How do you find out what is in "other" ? how do you delete what is in "other" without loosing important files?

    In "About This Mac, on OSX MAVERICKS, under "Storage" How do you find out what is in "other" ? how do you delete what is in "other" without loosing important files?

    About "Other":
        http://pondini.org/OSX/LionStorage.html
    Hope this helps.
    1. Start up in Safe Mode
        http://support.apple.com/kb/PH11212
    2. Empty Trash.
        http://support.apple.com/kb/PH10677
    3. Delete "Recovered Messages", if any.
        Hold the option key down and click "Go" menu in the Finder menu bar.
        Select "Library" from the dropdown.
        Library > Mail > V2 > Mailboxes
        Delete "Recovered Messages", if any.
        Empty Trash. Restart.
    4. Repair Disk
        Steps 1 through 7
        http://support.apple.com/kb/PH5836
    5. Disk space / Time Machine ?/ Local Snapshots
       http://support.apple.com/kb/ht4878
    6. Re-index Macintosh HD
       System Preferences > Spotlight > Privacy
       http://support.apple.com/kb/ht2409

  • How do you find an event in iMovie? I input a file today.  It has disappeared.

    Today, i input a new event form my Sony camcorder into the latest version of iMovie.  It is labeled 2014-1-11.  I then imput another event and labeed it 2014-1-10. The first file name disappeared.  After about 75% of the second file was inported, iMovie unexpectedly quit.  After I opened iMovie again, both file names had disappeared.  I started to input the file that quit for a second time.  I received an error message that the file name 2014-1-10 was already in use, however I cannot find either of the files.  How can I find the missing files?
    Thanks.
    P.S.  So far, I do not like this version of iMovie.  I was getting half decent at using iMovie11.  The new version has been difficult for me to use.  It is taking forever to insert photos.  I am very frustrated.  I have talked to a few people at the Apple store and not getting a warm feeling that the situation will improve.  Does anyone know when a new version if iMovie for Dummies, or any kind of a comprehensive book on the latest version of iMovie, will be available? 

    Much appreciated, James. However, I found this response confusing, because until I read your message, I had renamed files in the finder by clicking near the begining of the file name. Maybe other people use that method to, so they may have initially misunderstood your response. So I thought I would mention that renaming in the finder with "enter" isn't the only way, but it appears so with iMovie. Thanks!

  • Hello! I have one iTunes library on my iPod and one iTunes library on my computer. When I connect my iPod touch to my PC, however, I cannot find any files in my iPod except for pictures. How can I find the music files so I can add them to my iTunes?

    Hello! I have one iTunes library on my iPod and one iTunes library on my computer. When I connect my iPod touch to my PC, however, I cannot find any files in my iPod except for pictures. How can I find the music files so I can add them to my iTunes?

    You can't do that.
    And before you decide to store any music that you own on a computer at work, talk to your IT department. Many organizations do not permit it for legal reasons. Standard policies are that anything stored on company owned computers is the property of the company. It could not be legally stored on their machines unless you transfer the licenses and all copies, physical and digital, to the company, meaning you no longer own the music. If they were to be audited and could not prove that they own the music, they would be subject to copyright violation penalties. Just use your iPod when you're at the office if you want to listen to music.

  • How can i find out the file size of a Keynote on an iPad please?

    How can i find out the file size of a Keynote on an iPad please?

    I think a rule of thumb is what you're looking for.
    Full bandwidth CD audio (AIFF): about 10 MB/min
    Apple Lossless: about 5 MB/min
    MP3 @ 256k: about 2 MB/min
    MP3 @ 128k: about 1 MB/min
    Of course the MP3 file size is exactly linear with bit rate.
    As for sound quality:
    Apple Lossless is, as the name says, lossless.
    MP3 @128k: fine for listening in the car or the kitchen etc. If you have an audiophile sound system, this will remind you why you spent all that money.
    MP3 @256K: barely distinguishable from CD on very good equipment.
    MP3 @320K: probably not distinguishable from CD.
    I presume that since you're talking about importing classical CDs these are ones you own. Remember you can always do it again if you need higher fidelity or if better technology comes out. I import most CDs at 128k, since most of my MP3 listening is in the car, or walking, or as background. And I can always play the CD if I want to sit and listen.
    The logic for purchased music is totally different -- you probably won't get to upgrade that without buying it some different way. So buying 128k MP3s (or AACs) is something you'll probably regret later. Buying 256k MP3s is a lot less problematic.

  • How do I find out a file in a disk?

    can anyone tell me
    how to I find out a file in a disk?
    Thanks in advance.

    That's almost a haiku you wrote there, isn't it?
    There's no standard API class/method to do that so you need to write your own: you'll have to pass through directories recursively. The File.list method will help you get file listings from a directory.

  • How do I find duplicate songs/files in iTunes 11?

    How do I find duplicate songs/files in iTunes 11?
    Earlier versions of iTunes had a simple menu option to click on.
    All duplicates would then be listed. Cannot find this option now.
    Regards ..... blayk.

    If you want to free up your memory, maybe first checking to see if you got duplicates. -
    From the File menu in iTunes, choose Show Duplicates. iTunes will then list all of the duplicate titles in your library.
    If you delete a music in the iTunes folder, then when you try to play that particular music in your iTunes, it won't work as iTunes wouldn't be able to find it. However, when you import music on to your computer, always import straight into your iTunes, no where else.

  • How do I find a corrupted file in a backup folder on my computer?

    I have recently had to replace the battery in my iphone, but before doing so, I had backed up the phone about 3 times, all saying they were successful.  And then I had erased the phone(before I realised the battery was the problem).  However when I went back to restore from the backup, it says that it cannot be restored because the backup is corrupt.  I read on one site that sometimes if a phone turns off or disconnects while backing, it might cause a corrupt file, and I think that's exactly what my phone did due to the battery issues.  The big question is, is it only specific files inside the backup folder that are corrupt?  And how do I find out which files they are?  Please help.

    Hi
    This can be an issue on other end ( server end ) as export to HTML works fine so Muse is exporting the files correctly but while exporting to external server if it stuck then we should check on server side if there is any problem related to specific file upload.
    As a workaround, you can use any FTP client and then upload the exported html files to root location.
    Thanks,
    Sanjit

  • How do I find my music files in iCloud?

    How di I find my music files in iCloud?

    To Find your music You would Enter iTunes then do the following: Search for Quick links on the right> then Select Purchase> From there you can search for All Media that you have on iTunes, can all select  from the two options on the Right> All or Not on this Computer & then once you've selected your choice you can see what you have and what's not on your computer, but this only works for media you've purchases through iTunes. I hope this clears things up.

  • I backed up my ipod during a windows backup.  how do i find those ipod files(not itunes) in the windows backup files? i've tried searching and i can't find

    i backed up my ipod during a windows backup.  how do i find those ipod files(not itunes) in the windows backup files? i've tried searching and i can't find

    so i plugged in my ipod and it asked if i wanted to backup the files before restoring it. 
    Do you mean iTunes asked if you wanted to backup files before restoring? If so the it is in the location I posted. You don't need to navigate to the backup. Once your restore your iPod it will ask if you want to restore from a backup and present you with the backups made before hand.
    To restore information from a backup, use one of the following methods after connecting your iOS device to the computer with which you normally sync:
    -Click the File menu and select Devices > Restore from Back up.
    Or
    -Open the iOS device's Summary tab. There are two ways to access this:
    -Click the device button in the upper right corner. (If viewing the iTunes Store, click the Library button in the upper right corner. The device button will then be visible.)
    -From any view in iTunes, click the View menu and select Show Sidebar. Select your iOS device in iTunes under Devices.
    -Click the Restore Backup button.

Maybe you are looking for

  • How to Allow the End User to Save a Form

    How do I allow an end user to save form after they've filled it out? I understand this can be accomplished using the distribute function where you email the form to people. We don't want to do that. We want to put it on a website and allow them to ac

  • Getting tdb_link error : Signal ( 11 ) !!! Need Help !!

    Hi, While compiling and linking my code through make file.. tdb_link error is comming. Below is the snippet of the error: /usr/dist/share/devpro,v4.2/5.x-sparc/bin/CC-4.2 -o ../bin/brp_module1_v8 brp_module1.o rule_print.o atp_rule.o supply.o gbm_dat

  • Has anyone else had the screws fall out of the bottom of 2012 2013 Macbook Pro Retina?

    Apple tried to repair my Macbook Pro Retina when I first got it. They took the back off, replaced the motherboard (which was not the problem), and returned it to me the next day (via FedEx). When I got the machine back, half of the screws on the back

  • Text Will Not Filter in Report

    I'm trying to filter a table object in SSRS by passing only certain values to it.  I'm using the IN clause with the SPLIT() function in the filter and for the most part it works okay.  However, i'm trying to pass a string which has a "%" character in

  • Conversion Agent Java API

    I'm looking for Conversion Agent Java API. Would you please advise where I can find this API. Thanks.