JFileChooser to get file path

Hallo,
Is ther any method return the path of file choosen from the
FileChooser component to my TextField of my frame?

hey,
Thank you for your help,
What about a jar file, if I choose a jar file ,how can I Know all its files names that it is contained without extracting it?
There is a entries () method in a JarFile class which return enumeration for the zip file entries. So I can make a loop to extract file names, but the problem is:
That the file returned by getSelectedFile() method is a File type, but if I choose the jar file type "example : Hello.jar" ,I would like to use the entries method at this file but in the program its type is File ,
how can i make it JarFile type?
Here it is a part of a code of my program:
/*global variable*/
Static  private final String newline = "\n";   
JFileChooser   fc;
/* a part of a program code*/
//the file chosen �case: if it is a jar file type�
//but its type is File not JarFile
   File file = fc.getSelectedFile();         
                    try {
//I tries to convert the file to jar file but it is impossible
                     JarFile  jarFile =(JarFile) file;
                    } catch (IOException ex) {
                        ex.printStackTrace();
//entries method to extract the files name that the jar file contains
                Enumeration entre = jarFile.entries();
                while(entre.hasMoreElements()){
                   File f= (File) entre.nextElement();
                    classList.append("openning :"+  f.toString()+"."+newLine);
                }

Similar Messages

  • Error code -43 - unable to get file path when burning DVD

    I just installed Tiger on my son's iMac 500. Borrowed a Lacie DVD r/w and tried to burn the contents of a user folder to a DVD-R. It burned part of it, but failed with the following error:
    The operation can not be completed because one or more
    required items an not be found. (Error coed -43).
    Could not open the dat fork of "<unable to get file path>" (-43).
    I was able to burn a CD on the drive, but that was for another user directory that fit on a CD-R. The folder I was trying to burn to the DVD was about 1.1 G.
    Thanks,
    Alfredo

    I just installed Tiger on my son's iMac 500. Borrowed a Lacie DVD r/w and tried to burn the contents of a user folder to a DVD-R. It burned part of it, but failed with the following error:
    The operation can not be completed because one or more
    required items an not be found. (Error coed -43).
    Could not open the dat fork of "<unable to get file path>" (-43).
    I was able to burn a CD on the drive, but that was for another user directory that fit on a CD-R. The folder I was trying to burn to the DVD was about 1.1 G.
    Thanks,
    Alfredo

  • Bug when getting file path in non-english Windows Vista

    Hello,
    I'm getting an error when trying to get the file path of a video in a non-english Windows Vista... The code is:
    var file = "video.flv"
    var filePath = air.File.applicationStorageDirectory.resolvePath(file);
    filePath = filePath.nativePath;
    The filePath variable is used later by a flash video player to load the video file..
    In the brazilian Windows Vista the path of the StorageDirectory would be something like "C:\Usuários\(user name)\..." but if I run this script it returns "C:\Users\(user name)\..." as the native path.
    The problem seems to be in the "nativePath" function, cause I'm able to copy files to the app-storage folder using the "air.File.appicationStorageDirectory.resolvePath()" method without any problems.
    I could insert a small code which substitutes "Users" with "Usuários" but then it wouldn't work on an english Vista...
    Any ideas on this? Is there a way to check the language of the operating system in Air so to act accordingly?
    Thanks for any help!

    Hello,
    has anybody found a solution?
    Testcase: SQL Developer 3.1 on a German XP with default NLS Settings
    CREATE TABLE "TEST_TABLE"
           "NUM" NUMBER
          ,"VCH"  VARCHAR2(10 BYTE)
        ) ;Test file test_insert.dsv
    num;vch
    1;KL
    1,5;tz
    12345,45;ooImporting using the wizard inserts the first row correctly, for the others I get
    SET DEFINE OFF
    --Einfügen für Zeilen  1  bis  3  nicht erfolgreich
    --ORA-01722: invalid number
    --Zeile 2
    INSERT INTO TEST_TABLE (NUM, VCH) VALUES (1.5,'tz');
    --Zeile 3
    INSERT INTO TEST_TABLE (NUM, VCH) VALUES (12345.45,'oo');Beside the wrong umlaut in the message the insert statement itself is correct, because you cannot use the german decimal separator "," in the script. The bug is, that it should use the same NLS settings for generating and running the script.
    Regards
    Marcus

  • How to get file path in the form \\filer01\dir\index.htm

    Hi,
    after selecting a file using the FileChooser dialog, i would like to convert the file path like "H:\index.htm" into a form like "\\filer01\dir\index.htm".
    On my system, the logical device name H:\ is mapped to a directory on a file server "filer01".
    Is there any possibility to do this conversion?
    Thanks in advance.

    hi,
    i dont think java has a way of figuring out the actual mappings for a drive, you can retrive all drives that are present using the following code
    File [] roots = File.listRoots();
    then you could just iterate through the roots some of which may be mapped (but you cant figure out which is mapped and which is not).
    So i guess the best way to do it is to have a Properties file with key,value mappings. for eg
    h:\\, \\file01\dir\..
    and then read the value from the Properties file, now if you want this for accessing a resource across the network you dont require to get the actual mapping, you can still use the mapped drive as you would use a unmapped drive.
    hope this helpz
    cheerz
    ynkrish

  • CS2/CS3/CS4: Cannot get file path in Unicode of the current document on Windows

    Hi All,
    In my automation plugin I need to have full absolute path of the opened document with any possible non-English letters. Using SDK examples Listener and Getter that come with Photoshop SDK the full absolute path which I obtain is in the default ANSI code page (CP_ACP) and I can convert it to Unicode using MultiByteToWideChar() API. However this works well when I have corresponding to document name language set in the "Control Panel -> Regional and Language Options -> Advanced -> Select a language to match the language version of the non-Unicode programs you want to use." For example if name of the document has Russian letters and chosen language in "Regional and Language Options" is also Russian the described conversion works well. If I change "Regional and Language Options" to English for example, full path returned by Photoshop SDK API (AliasToFullPath in PIUFile.cpp) for the document with Russian letters will contain "????????.psd" symbols.
    So I need to have an ability to get absolute file path in Unicode. Is it possible in Photoshop CS2/CS3/CS4 for Windows? I have searched forum and SDK but could not find info on it.
    Is it possible to have native HANDLE of the opened file to get file info using Windows API?
    Please advice.
    Below given slightly modified code from Photoshop CS3 which I use to get absolute file pat of the opened document.
    Thanks and regards,
    Sergey
    std::string outFilePath;
    int32 theID = 0;
    SPErr error = kSPNoError;
    error = PIUGetInfo(classDocument, keyDocumentID, &theID, NULL);
    if (error == kSPNoError)
    Handle theFileHandle = NULL;
    error = PIUGetInfoByID(theID, classDocument, keyFileReference, &theFileHandle, NULL);
    if (error == kSPNoError)
    int32 length = sPSHandle->GetSize(theFileHandle);
    Boolean oldLock = FALSE;
    Ptr pointer = NULL;
    sPSHandle->SetLock(theFileHandle, true, &pointer, &oldLock);
    if (pointer != NULL)
    outFilePath = (char*)pointer;
    sPSHandle->SetLock(theFileHandle, oldLock, &pointer, &oldLock);

    Hi All,
    Does anybody know, whether it is possible to get Unicode file path of the current document in Photoshop via Photoshop SDK API or without them?
    Thanks,
    Serhiy

  • How do I get file paths when hovering over a file name in Mountain Lion?

    In Snow Leopard I used to be able to hover over any file name and immediately get a file path in a small yellow window. What has happened to this feature in Mountain Lion?

    arthur, thanks for the path bar tip. That is what I needed. Solved the problem.
    I don't know what has happened to the yellow window that would appear if you hovered over any file showing the path of the file. It was simple to see the path with this window that appeared and disappeared if you moved the cursor.

  • Using AppleScript/Automator to get file path and create AFP hyperlink

    Hi All,
    A colleague has asked for a service (contextual menu item in Finder) to get a selected item's remote (afp://) file path and copy it to the clipboard...  Pretty sure I've got that part down. 
    What I need advice on is how to make the resulting pasted file path into a serviceable hyperlink.  AFP keeps telling me there was an error connection to the server....  Does the copied path have to include mounting commands and user credentials for this to work??
    Thanks,
    Nathan

    Hi Richard - here's the script:
    tell application "Finder"
              set sel to the selection as text
              set TempTID to AppleScript's text item delimiters
              set AppleScript's text item delimiters to space
              set sel to text items of sel
              set AppleScript's text item delimiters to "%20"
              set sel to sel as string
              set AppleScript's text item delimiters to TempTID
    set the clipboard to "file://" & POSIX path of sel
    end tell

  • Getting File Path to Open

    Is there a way to copy a full file path from a cell in Microsoft Excel to the clipboard and have Finder open it using another program?
    the Microsoft Excel cell looks like this...
    Primary Hard Drive:Microstock 2.0:Automation Processes:Automating Folder System:Bright:Bright Series Choices Circles.jpg
    the script I have looks like this but won't work...
    tell application "Microsoft Excel" to copy range (cell "B1" of worksheet "Keywording 2.0" of workbook "Metadata")
    set thefile to (the clipboard)
    tell application "Finder" to open thefile using "Primary Hard Drive:Applications:Adobe Bridge CS4:Adobe Bridge CS4"
    tell application "Adobe Bridge CS4" to activate
    I get an error "Can't make "Description" into type item.

    There are several flaws with your script, which are compounding your problem.
    First off, you're using copy range within Excel, which isn't what you want - that's intended to copy a range of cells within a worksheet to another worksheet.
    Secondly, even if that did work, you really don't want to use the clipboard for this. There's no need, for a start, and it disrupts whatever else the user may have had on the clipboard. Just think of AppleScript variables as being an infinite number of named clipboards and you can see that you could easily use an AppleScript variable to pass the data between Excel and the Finder.
    So, first off, getting the data out of Excel, you want to get the value of the cell and put it in an AppleScript variable:
    tell application "Microsoft Excel" to set myFilePath to value of (cell "B1" of worksheet "Keywording 2.0" of workbook "Metadata")
    Now myFilePath has the path data, which you can pass to the Finder:
    tell application "Finder" to open file myFilePath
    (although there may be no need to use the Finder at all for this - you can open the file directly, or tell Adobe Bridge to open the file, but the point of using AppleScript variables still stands)

  • How to get file path?

    Hi all,
    I have a tcode ysd_gr. When I execute it, it has one select option & I entered the values as *.csv. It gave 6 csv files(only file names) & I want to retreive data from one file.
    So I need to find the file path. The functional consultants told that the files are in Application server (there are more than 5 application servers are used here).
    So I need to know how to find the file path  and in which application server the file is placed.
    Thanks in advance,
    Vijay.

    Go to t-code AL11 and give the path name excluding the file name:
    I mean for example the name is as below:
    D:\usr\sap\IDS\DVEBMGS00\data\test.csv
    here test.csv is the file name.
    So go to AL11 and give upto D:\usr\sap\IDS\DVEBMGS00\data and dauble click on it and search for the file name.
    Hope this will solve your problem.
    Reward if helpful.
    Thank you.

  • Opening PDFs get "file path is not valid" errmsg

    very strange...
    I dumped a bunch of PDFs, word, excel & ppt files onto the documents folder. 
    All the PDFs give me "file path is not valid" errmsg and cannot be opened.
    But the word, excel & ppt files can be opened.
    Can someone help me figure it out? 
    Thanks.
    Solved!
    Go to Solution.

    solution is here: http://forums.crackberry.com/showthread.php?t=607769
    I feel also compelled to mention that I've had a ticket open at rim for this issue since 04/21 and have been escalated numerous times and yet all this time rim support has had no clue how simple the problem is to fix. This solution was posted >2 full days ago.

  • Some help needed getting file path

    I had some help earlier attaching a file to mail via a dialog. That worked great.
    Now I am trying to get a particular file to attach.
    The following works but if i try to dynamically define the path ie comment out line 1 and bring into the script lines 2 and 3 it only adds the folder (line one). Any ideas?
    tell application "Finder" to set the_files to {alias "Alberti work:WSC projects:WSC Blue Haven 440b:Construction:Progress Certificates:440b_progress certificate_8.pdf"} --------------line 1
    --set the_path to "Alberti work:WSC projects:WSC Blue Haven 440b:Construction:Progress Certificates:" as alias ---------line 2
    --set attach_file to "440b_progress certificate_8.pdf" -------line 3
    tell application "Finder" to set the_files to the_path & attach_file
    tell application "Mail" to tell (make new outgoing message) to set visible to true
    tell application "Mail"
    tell front outgoing message
    repeat with a_file in the_files
    make new attachment with properties {file name:a_file} at after the last paragraph
    end repeat
    set visible to true
    end tell
    end tell

    Your problem is in the line:
    <pre class=command>tell application "Finder" to set the_files to the_path & attach_file</pre>
    where the_path is an alias and attach_file is a string representing the file name.
    When you use the concatenate operator ( & ) with two different object classes (in this case an alias and a string), you get a list as the result, so after this line runs the_files equates to a list containing two items:
    <pre class=command>{alias "Alberti work:WSC projects:WSC Blue Haven 440b:Construction:Progress Certificates:", "440b_progress certificate_8.pdf"}</pre>
    There's no way that Mail.app can translate that into something that can be attached to an email message.
    Instead, what you want to do is NOT define the_path as an alias, leave it as a string. Now the above line would result in one long string of the form:
    <pre class=command>"Alberti work:WSC projects:WSC Blue Haven 440b:Construction:Progress Certificates:440b_progress certificate_8.pdf"</pre> 
    which can easily be coerced to an alias suitable for Mail.app:
    <pre class=command>set the_path to "Alberti work:WSC projects:WSC Blue Haven 440b:Construction:Progress Certificates:"
    set attach_file to "440b_progress certificate_8.pdf"
     tell application "Finder" to set the_files to alias (the_path & attach_file)</pre>

  • Get file path name for an given FileInputStream

    It sounds wired, but I do want to see if it is possible. Say we have a FileInputStream fis, which has been instantiated and valid. I would like to get the File associated with this FileInputStream. Is this possible and how?
    Thanks.

    It sounds wired, but I do want to see if it is
    possible. Say we have a FileInputStream fis, which
    has been instantiated and valid. I would like to get
    the File associated with this FileInputStream. Is
    this possible and how?
    Thanks.A FileInputStream may not be associated with a "disk file" at all. From javadocs, FileInputStream can be created from a [url http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileInputStream.html#FileInputStream(java.io.FileDescriptor)]FileDescriptor, which can represent [url http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileDescriptor.html#skip-navbar_top]an open file, an open socket, or another source or sink of bytes.

  • Getting file path where .jar file resides

    I'm using a .jar file to run my Java app. Can anyone tell me how to return the directory where the .jar file is being run? Thanks very much.
    -Pete

    You can get the folder or jar file from which a given class was loaded.
    URL source = getClass().getProtectionDomain().getCodeSource().getLocation();
    String filePath = source.getFile();

  • Could not open the data form of " unable to get file path " (-43)

    I am trying to backup my wife's home directory. I've tried twice and ended up with costers each time. One with a DVD and another with a CD-R. I did try to backup some of the folders in her ~/Libray folder, could that be the problem?
    Thanks,
    Alfredo

    If you have FWHDs hooked up to both machines, why are you trying to backup to disk? You're better off just dragging the Users folder to the ext FWHD.
    BTW, fnfErr = -43, /*File not found*/, but I don't know why you'd get that error message putting files into a disk image or using Finder's find.

  • Urgent : get file path

    hello there,
    how can i knw the path of a file using features of java?
    i cn obtain file Name by using f.getPath(), where f is my File Object.

    Hi,
    Read the javadoc:
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html
    The File class has the method which you are looking for.
    Kaj

Maybe you are looking for