Getting the entire file path using "Browse button"

Hi All,
I searched the forum for the solution, but did not find it there.
I am using JFileChooser to browse and select a file.
then i have to pass this file as and argument to another java program where it reads the file and sends it to the server.
Now what i actually want is, when the file is selected i want to get the file nam along with the path i.e. C:/temp/temp.doc
instead i am getting only temp.doc.
I tried setting the JFileChooser mode as DIRECTORIES_ONLY. But that gives me only C:/temp and not the file name.
If i set it as FILES_AND_DIRECTORIES it again gives me only the file name and not the path.
pls. help me. its urgent.
thanks

What is wrong with JFileChooser.getSelectedFile()? From the returned File object you can get the canonical name which sounds to be what you want.

Similar Messages

  • Getting the full file path from FormFile

    Hi, I am reading in a .csv file from my JSP page and I want to pass the String path from my Action class to the logic layer class. When I try and pass it at the moment, it throws an FileNotFound error as it is only passing the file name. i.e
    Passing
    text.csv
    not
    C:\text.csv
    Is there anyway of detirming the full file path using the FormFile class?
    Thanks in advance

    Yes, as in Struts.
    I am not trying to upload the file, simply trying to read the contents from the file. My problem is that I want to read the contents from one of my business logic classes, not within my struts Action. I can get it working if I use
    byte[] datainfile = file.getFileData();
    and then send that but the I would prefer to just send the full path to my Business logic class and process everything in there rather than doing some in my Action and some in my logic class.
    So what I would like to put in my Action class is something such as
    processCSVFile(String filePath);
    instead of
    processCSVFile(Byte[] formFile);

  • Get the preferences file path ?

    Hi guys,
    is there any way to get the preferences file path from the SDK ?
    (exp : C:\Documents and Settings\[user]\Application Data\Adobe\Acrobat\8.0\Preferences)
    I'm using C++
    Thx in advance

    Yes, using the plugin APIs. There is a AVAppGetSpecialFolder() call that you can use.

  • Teststand 1.03 - How can I get the sequence file path into an expression?

    The sequence file will be located at different locations on different computers. I need the base address of the sequence file to get to the correct limits file. How can I get the sequence file path into a string-local expression.
    Thanks

    As Ray described, the FindFile expression function and TS API method will seach all TS search directories and return to you the path of your file, assuming the file is located in the search directories.
    If you just want the path of a TS file that you have a reference to then there is a faster, easier method. You can use the Path property of the PropertyObjectFile class. In the attached example I use an AcitiveX Automation adapter step to call Path on the property RunState.SequenceFile. This returns the path to the current executing sequence file. Note that if you have not yet saved the sequence file then the path will be empty. In a subsequence step I strip off the file name leaving the root path of the file.
    Attachments:
    GetSeqFilePath.seq ‏22 KB

  • How to Get the Source File Path in the Receiver Side

    Hi Experts,
    Here We are Trying to Do How to Get the Sender Information ( File Name & Path ) on the Receiver Side .
    According to the Michal Blog
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Here we Are Able to Get only the File Name.
    But If I Want to get the Total File  Path Also means What Should I Do Here ????
    Please Let Me Know
    Regards
    Khanna

    Khanna,
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey fkey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    DynamicConfigurationKey dkey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
    String fname = conf.get(fkey);
    Sring path = conf.get(dkey);
    String final=fname""path;
    return ""final"";
    Best regards,
    raj.

  • How do i show the filename.type instead of the entire file path?

    How do i show the filename.type instead of the entire file path?
    I want it to show "ProgramSetup.exe" instead of "C:/Program Files/Oracle/JavaFX/ProgramSetup.exe"
    I have created a JavaFX program with the help of my manager
    below are the code
                   File file = fileChooser.showOpenDialog(Admin.mainStage);
                   if (file != null) {
                        textFiles.setText(file.getAbsolutePath());
                        String absolutePath = file.getAbsolutePath();
                        //String fileName = new File(absolutePath).getName();the reason i put the last line as // because it has error on that line....
    if i remove the last line, it will display but with the full path....
    i search through google and the guide on many forums aren't clear to me.....some said there are 2 ways but i tried and it is not working, atleast for me...maybe i left out something or what....can anyone help me on this?

    You don’t need the absolutePath:
    File file = fileChooser.showOpenDialog(Admin.mainStage);
                   if (file != null) {
                        textFiles.setText(file.getName());
                               }

  • How to get the update file without using Nokia Sof...

    The network connection is unreliable and downloading the firmware update using PC Suite for my Nokia E90 proves difficult. Does anyone know how I can get the firmware version 300.34.84?
    The trouble is Nokia's Software Updater does not accommodate any slight interruption to the connection during the update process. I will update this discussion with what version of PC Suite I have once I get that info.
    Any help is kindly appreciated

    In fact, it is not Possible to get the update file without using Nokia Software Updater or you should search the net to find the update files in another place and even you get them, you can not use them with NSU.
    You can Update your Device with:
    1 - NSU (Nokia Software Update)
    2 - FOTA (Firmware Over The Air) for FP2 devices ONLY.
    3 - Nokia Care Center
    there is not other way to upgrade.
    Hope useful for u.
    regards
    Nokia N79 4GB
    SW Version: 32.001 RM-348 MEA

  • Missing Photographs - 5,000 in total - is there a programmatic way to get the complete file paths missing?

    HostOS : Mac OS X
    LightRoom version : 4.4
    I accidentally moved linked files over the past few years, and just discovered (via "Missing Photos" view) that I have 5,000 missing photos.
    I know the master photos are on my hard disk drive ... so, that is the good news.
    BUT I do not want to have to click to re-link all 5,000 missing photos one at a time.
    Is there a way to programmatically get the list of file paths of those 5,000 missing photos on my MacOSX system  -- so that I can write an AppleScript to extract the unique image file name from the full file path extracted from LightRoom, locate the image in Finder, and move it back to the expected file path where Lightroom expects to find it?

    If most of your reorganization consisted of moving whole folders rather than individual pics,  you can quickly relink entire folders, or even folders of folders, rather than individual pics.  In the Folders pane on the left, right-click the missing folder and select Find Missing Folder.
    If you moved individual files rather than entire folders, then to get a list of the file paths of all the missing files, first do Library > Find All Missing Photos. Then use the ListView plugin to get a list of the photos' file paths into a text file.

  • How to force the File Path Control Browser button to the RT Target instead of the host machine?

    I am building an application on a RT PXI system, and for one of the functions I would like the user to be able to use the browser button of the File Path Control to choose a directory on the PXI. However the browser button seems to only want open a file on the host PC, even though the application is fully deployed on the target. Note that I am controlling the PXI from a host PC.
    If anyone has any suggestions that would be great. Thanks.

    Hi,
    Unfortunately, there is not a VI to do this. Are you browsing to these files from your host VI? In order to access the files on your PXI RT target, you'll need to FTP in and browse to them that way. You could programmatically do this, but there is not a simple VI to do so.
    Amanda Howard
    Americas Services and Support Recruiting Manager
    National Instruments

  • File path control - browse button colour/color

    I can't change the colour of the browse button on a file path control. I'm using LV 8.5, but I think I have the same problem on 7.1
    Is the only way to change the colour to customise the control? Every other part of it seems to take colours from the tools palette.
    Thanks for any pearls of wisdom.
    Jon.

    I am able to change the path browse button color in 8.51 are you trying to change the button color or the color of the folder on the button.  To change the buttoin color use the paint tool and make sure you hit the space bar so you are painting the left color (Background color I cant remember which is which).  This probably doesnt work on system buttons.
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • How Can I get the Jar file path ?

    I have an aplication in a Jar file. This application might be situated in any directory.
    I would like to know programatically the path where it was installed.
    Is there any way to know this simple thing in Java? I cannot believe that there is not a function like System.getProperty("user.dir") for this as System.getProperty("user.dir") will always return the directory from where the Java VM was lauched!
    Thank you!

    You can get the location with:
    URL codeBase = getClass().getProtectionDomain().getCodeBase().getLocation();But as has been pointed out, it's probably better to specify the directory to store these files some other way, e.g. use a batch file or shell script to launch your program and make it the cuirrent directory, or put the directory in as a property or command argument.

  • How to get the current FILE PATH?

    I want to get the File Path on my Java Programming, which class / method can get a File Path on the windows?
    thanks!

    I want to get the current working directory(e.g.
    c:\Tomcat5.0\webapps\)
    If this is a web application you're talking about and you want the directory where that application is installed, that's almost certainly not the CWD. It might be one of the context or whatever variables that's available to servlets. Look in the servlet API and see what's there.

  • How to get the incoming file name using JMS adapter and SOAP adapter

    Hi Everybody,
       In one of my interface i need to get the file name of incoming flat file using JMS adapter at sender side. and then i am using xslt to convert it to IDOC and then posting to  SAP IDOC.
    my incoming filname are in this form price<DateTimestamp>.txt. when i do the tranformation this incoming file name should be part of one element in the IDOC which i am posting.
    EX:
    <IDOC
    <REF>price<DateTimestamp>.txt</REF>
    </IDOC>
    Hope it is clear to everybody. I need your suggestion how i can capture this incoming file name and send it as part of IDOC.
    Thanks
    raj

    If they are passing it in message id or correlation id,
    you can access it using
    <xsl:variable name="dynamic-conf" 
            select="map:get($inputparam, 'DynamicConfiguration')" />
        <xsl:variable name="dynamic-key"  
            select="key:create('http://sap.com/xi/XI/System/JMS', 'DCJMSMessageID/ DCJMSCorrelationID')" />
        <xsl:variable name="dynamic-value"
            select="dyn:get($dynamic-conf, $dynamic-key)" />
    Check this:
    http://help.sap.com/saphelp_nw70/helpdata/en/f4/2d6189f0e27a4894ad517961762db7/content.htm
    Thanks,
    Beena.

  • Getting the selected row (selected using radio button in dataTable)

    I have problem getting the selected row.
    If not mistaken, the way used in BalusC's website sets the value to the backing bean using the valueChangeListener.
    Can I set the value to the DTO instead?
    using something like
    private boolean selected;
    public void setSelectedItem(ValueChangeEvent e){
    this.selected = true;
    }  If i use this way it throws NoSuchMethodException. I have no idea why. I did this for the checkbox and it works fine. I don't know why it doesn't work for radio buttons.

    The DataTable is below :
    <h:panelGrid columns="1" columnClasses="table_align">
              <t:dataTable id="table1" value="#{sysMgrBean.locationList}"
                   var="location" rows="5" styleClass="table" headerClass="tableHeader"
                   rowClasses="tableRowOdd, tableRowEven" width="500">
                   <t:column>
                        <f:facet name="header">
                             <h:outputText styleClass="lbl" value="#{lbl['no']}" />
                        </f:facet>
                        <h:outputText value="#{location.id}" />
                   </t:column>
                   <t:column>
                        <f:facet name="header">
                             <h:outputText styleClass="lbl" value="#{lbl['slct']}" />
                        </f:facet>
                        <h:selectOneRadio  value="#{location.selected}"
                             onfocus="dataTableSelectOneRadio(this);"
                             onclick="enableInput(this.form,this)" valueChangeListener="#{location.setSelectedItem}">
                             <f:selectItem itemValue="" value="true" />
                        </h:selectOneRadio>
                   </t:column>
                   <t:column>
                        <f:facet name="header">
                             <h:outputText styleClass="lbl" value="#{lbl['cd']}" />
                        </f:facet>
                        <h:outputText value="#{location.loccd}" />
                   </t:column>
                   <t:column>
                        <f:facet name="header">
                             <h:outputText styleClass="lbl" value="#{lbl['desc']}" />
                        </f:facet>
                        <h:inputText id="Description" value="#{location.descr}" disabled="#{location.disabled}" />
                   </t:column>
              </t:dataTable>In the DTO :
    private boolean selected;
    public void setSelectedItem(ValueChangeEvent e){
    this.selected = true;
    }

  • How to get absolute File Path using JFileChooser?

    Hi,
    IS there any way by which we can get the absolute file path ? e.g. If I browse thro JFileUser and Selects "a.txt" and say open, it should return me the complete file
    path e.g. D:/abc/a.txt.
    Present method.fileChooser.getSelectedFile().getName() return the name of the file i.e. a.txt and NOT the complete path.
    Pls Help !!

    fileChooser.getSelectedFile().getAbsolutePath(); will do the trick.

Maybe you are looking for

  • IWork 09 system requirement for 9.0.4 update

    iWork 09 installs and runs on my iBook running OS X 10.4.11. However the update to iWork 9.0.4 will not install and gives the message that OS X 10.5 is required. I was surprised that there seems to have been a change in system requirement between iWo

  • WDA: OVS dynamically

    Hello, I have a need to create F4 help for dynamically created input field. I created component usage by name OVS. When I dynamically create an input field I have to also create a context attribute. Than bind this context attribute to my input field.

  • Quicktime Pro wont save video in rotated version, reverts to original.

    Despite following all the steps to rotate a video saved from iphone 4 it won't save its new version (PC) ..have clicked save as , re-named file and it will save as a new file but it is still upside down in the thembnail and if you open it with any ot

  • Comments and Comment icons will be moved to the botton of the page

    Why are the icons be moved to the bottom of the page once I shared it with acrobat.com The icons became very small, and it looks, that they has diapeared. I am using Window 7 Acrobat X 10.1.3

  • Problems with selection.fill/pathItem.fillPath -- Ps CS6, JSX, Windows

    Hi all, First post here I've started lately to play around with extended javascript (jsx) scripting on Photoshop CS6 (using 32-bit version on Windows 7 Ultimate). I've had much trouble with 'fill' commands. This one here gives me an Error 1200: Inter