Opening a file in its native application from Flex.

Is it possible to open a file on whatever native application the user runs it as?  Or even, at that, to simply open the directory it's in, in an explorer window?
We have a search application and the frontend is in Flex, and I'm trying to find a way to do this, such that when a use double clicks on a result (in a datagrid - but that's trivial), it opens the file or at least the location of the file on the OS.
Any system call where I can say system("explorer.exe " + filepath); or something?
Any help would be appreciated.

Dear BillBlalock ,
thank you for answer!! You are very kind and helpful!! I would like to inform everybody that I have finally find another way of soilving my problem and I announce it to the forum in case somebody else encounters the same problem. Well, I soved the nproblem by using the following code:
    excelButton.addActionListener(new ActionListener()
       public void actionPerformed(ActionEvent e)
         String filePath = "\""+saveFileName.toString()+"\"";
         System.out.println(""+filePath);
         try
           String cmd="explorer "+filePath;
           Process p = Runtime.getRuntime().exec(cmd);
         }catch(IOException ec){}
     });I hope it can be useful to somebody!! By this code, I can make a button (in my case the excelButton) to open any file in its default application. Keep up the great work you are doing guys!!

Similar Messages

  • Problem with opening a file in its application using Runtime

    Dear experts,
    excuse me for my ignorance, but I am facing a problem and I would really
    appreciate some help. I am working on a java program in which I want the user
    to have the ability to save the contents of a JTable into a file of his preference (the file could be of any type i.e xls, txt, doc...) and then open this file in its
    default application (i.e the txt file through notepad, the xls file through excel etc..).
    Everything works fine with the code below, if the filePath does not contain blank spaces. I did some search on the forun and the web, and also tried to
    find a solution through the great link
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html but I still
    cannot solve the problem. Below I quote the part of the code (actually the actionPerformed dunction of the equivallent button) which is responsible for the opening of the file.
        excelButton.addActionListener(new ActionListener()
           public void actionPerformed(ActionEvent e)
             //saveFileName is the File that I want to open
             String filePath = "\""+saveFileName.toString()+"\"";
             System.out.println(""+filePath);
             try
              String cmd="cmd.exe /C start "+filePath;
              String cmd="cmd.exe /C start C:\\Documents and Settings\\test.xls";
              Process p = Runtime.getRuntime().exec(cmd);
             }catch(IOException ec){}
         });Thank you in advance for your help!
    Sincerely yours,
    JIM

    Dear BillBlalock ,
    thank you for answer!! You are very kind and helpful!! I would like to inform everybody that I have finally find another way of soilving my problem and I announce it to the forum in case somebody else encounters the same problem. Well, I soved the nproblem by using the following code:
        excelButton.addActionListener(new ActionListener()
           public void actionPerformed(ActionEvent e)
             String filePath = "\""+saveFileName.toString()+"\"";
             System.out.println(""+filePath);
             try
               String cmd="explorer "+filePath;
               Process p = Runtime.getRuntime().exec(cmd);
             }catch(IOException ec){}
         });I hope it can be useful to somebody!! By this code, I can make a button (in my case the excelButton) to open any file in its default application. Keep up the great work you are doing guys!!

  • How to open file in their native application

    How to open file in their native application form web browser?
    if associated .txt file should open in editplus then from web browser if I try to open .txt file it should open in editplus rather then open in notepad(default), If on other computer if I associate .txt file should open in word, it should open in word. I am using Tomcat Web Server.

    that's nothing you could influence from a servlet or jsp.
    all you could do is specifying the content type of your response.
    Next you might hope that the client requesting your content uses a browser that relates the given content type to a special application (e.g. "text/plain" -> editplus or notepad or kedit or word or ...)

  • Open a file with its defualt associated application

    is there any way to open any file with its defualt associated application from a java program ?
    Example:
    In Windows I have a file example.txt and, from a java program, I would like opening it by the defualt associated application Notepad.
    Thx

    Take a look at this thread:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=161228

  • I can't open a file I just created a week ago and it says pages needs to be updated to open the file but its up to date

    I can't open a file I just created a week ago and it says pages needs to be updated to open the file but its up to date, what do I do?

    You have 2 versions of Pages on your Mac.
    Pages 5.2.2 is in your Applications folder.
    Pages '09/'08 is in your Applications/iWork folder.
    You are alternately opening the wrong versions.
    Pages '09/'08 can not open Pages 5 files and you will get the warning that you need a newer version.
    Pages 5.2 can open Pages '09 files but may damage/alter them. It can not open Pages '08 files at all.
    Older versions of Pages 5 can not open files from later versions of Pages 5.
    Once opened and saved in Pages 5 the Pages '09 files can not be opened in Pages '09.
    Anything that is saved to iCloud and opened in a newer version of Pages is also converted to Pages 5 files.
    All Pages files no matter what version and incompatibility have the same extension .pages.
    Pages 5 files are now only compatible with themselves on a very restricted set of hardware, software and Operating Systems and will not transfer correctly on any other server software than iCloud.
    Apple has removed over 110 features from Pages 5 and added many bugs:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    You can add the icon of the missing Pages on your Dock or open Pages from the Apple menu > Recent Items list.
    Or you can archive Pages 5 so that it doesn't automatically open.
    If you are unhappy about this review/rate Pages 5 in the App Store.
    Peter

  • Help - "Acrobat is being used by another application and cannot open PDF files until the other application is closed."

    Hello,
    I searched this site and google for this error terminology and come up dry.  I support a user who has been for years using Acrobat 5 (yes, I know...) to read files in a client DB program, as well as other PDF files on their PC.  In the last week or so, they have started gatting this error "Acrobat is being used by another application and cannot open PDF files until the other application is closed." any time they attempt to open a PDF file attached to an email (via Outlook).
    It is my understanding that they cannot upgrade to a newer version of Acrobat because of limitations of their client software, but had not previously had any issues viewing PDF notes from the DB, and PDF attachments in their email.
    I have tried uninstalling and re-installing, as well as tried using Adobe Reader 7 & 9 in conjunction with Acrobat to try to get around this issue, but have not been successful.
    Any ideas?
    Thanks,
    Jesse

    I don't have an answer to your technical problem. The product I assume is Acrobat that you are talking about (based on the post title), Adobe is the company name. This is a good place to ask questions on Acrobat if folks can figure out what you are talking about. They will ask for the product version number (like AA9.3.3), operating system, and other applications if appropriate. Also, just what you are doing that generates the message.
    As for Adobe, you are not likely to get an answer from them here in the user forum. You will be lucky if you can get an answer if you can contact them and not be on hold for more than an hour (sorry, this is why a lot of folks end up in the forum).
    So, to help others try to answer your question, what are the products and versions involved? What OS? What are you doing when the message comes up.

  • HT2041 I receive an error message when opening up a downloaded program as "Safari can't open the file because no availabel application can open it". Not sure what exactly this means or what I have to do!

    I receive an error message when opening up a downloaded program "safari can't open the file because no available application can open it" I am not sure what I need to do to get these programs open!

    What is the file?
    Where did you get it from?
    Allan

  • I downloaded acrobat reader dc. after download completed, I could not open many PDF files. Error read: "could not open this file because its either not a supported file or because the file has been damaged". I opened a new user account and moved these fil

    I recently downloaded acrobat reader dc. After download was complete, I could not open PDF files. Error read "Adobe acrobat reader DC could not open this file because its either not a supported file or the file has been damaged". Any suggestions?

    HI davidd92392148,
    Is this error occurring for all PDF files that you try to open? There is an issue where all file icons can change to the PDF icon after installation, so is it possible that the files you're trying to open have been affected by this issue (and aren't actually PDF files)? Please see Application, file icons change to Acrobat/Reader icon.
    If that document isn't the key, then please tell us more about these files. Where are they stored? Did they open in previous versions of Reader?
    Best,
    Sara

  • How do I prevent adobe reader from opening a file after it's saved from chrome adobe reader?

    Whenever I save a file from the chrome adobe reader, it opens automatically in adobe reader which is incredibly annoying. Please help!

    Ahh, but that's the design function of any PDF viewer add-on to a browser.
    To avoid -- Use the browser feature that saves a file to the local machine.
    Then open the file with the appropriate application.
    If your machine/device does not support this then you'd want to change to one that supports what you want eh.
    Be well...

  • I can't open pdf files I have down-loaded from Safari

    I can't open pdf files I have down-loaded from Safari (6.0 and OSX 10.8) with preview or acrobat. I get a corrupted file message. Anyone have a fix?

    From the Safari menu bar, select Safari ▹ Preferences… ▹ Security and uncheck the box labeled Enable plug-ins. Test.

  • When I open my files to download my pictures from my iphone 6 plus, there is a windows icon with a hard drive.  What is that? And why can't I delete it?

    When I open my files to download my pictures from my iphone 6 plus, there is a windows icon with a hard drive.  What is that? And why can't I delete it?  I already reset my phone and a week later they came back. 

    I download my pictures by:
    !) Connecting my iphone to he computer.
    2) It will open a window or I will go to my computer and select iphone device.
    3) Open up Iphone folders and download.
    When I do that, I see a windows icon, with what looks to be a hard drive.  And when I click on it, it leads me back to my desktop.  Right now, I only have one.  I know by tomorrow I will have more.  It just keeps spreading. 

  • How to Call a AIR application from Flex Application

    Hi,
        I have Used AIR (Desktop application) in Flex Builder to Upload a File from a local path and save it it a server path.
    I need to Call this AIR(Desktop application) from my Flex Application.... i.e
    I am using a link button to send a event using Script and Forward that Desktop application  from Flex Screen
    But it doesnot load that (Desktop application)  in Screen. Only Balnk screen is loaded from path
    Here is the code
    AIR(Desktop application)
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="openBrowseWindow();">
    <mx:HTTPService id="urlpath" showBusyCursor="true" useProxy="false" method="
    POST" url="http://localhost:8080/nat/FlexAction.do?method=UrlPath"result="pathresult(event)"
    fault="faultHandler(event)"
    >  
    </mx:HTTPService> 
    <mx:Script>
    <![CDATA[
    import mx.events.FileEvent; 
    import mx.rpc.events.ResultEvent; 
    import mx.rpc.events.FaultEvent; 
    import mx.utils.ObjectUtil;  
    import mx.controls.Alert;
    private  
    var openFile:File = new File() 
    private  
    function openBrowseWindow():void{openFile.addEventListener(Event.SELECT, onOpenFileComplete);
    openFile.addEventListener(Event.OPEN, load);
    openFile.browse();
    private  
    function load():void{Alert.show(
    "load"); 
    var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png"); 
    //var textTypes:FileFilter = new FileFilter("Text Files (*.txt, *.rtf)", "*.txt; *.rtf"); 
    var allTypes:Array = new Array(imageTypes);openFile.browse(allTypes);
    private  
    function faultHandler(event:FaultEvent):void { 
    //Alert.show("Fault")Alert.show(ObjectUtil.toString(event.fault));
     private  
    function pathresult(event:ResultEvent):void{Alert.show(
    "res") 
    //Alert.show(ObjectUtil.toString(event.result));}private  
    function onOpenFileComplete(event:Event):void{ 
    //mx.controls.Alert.show("event: "+event.target.nativePath +"UR!!!"); 
    var pPath = event.target.nativePath; 
    var parameters:Object = {FlexActionType:"PATH",path:pPath};  
    // Alert.show("Image Selected from Path : "+pPath); urlpath.send(parameters);
    //Alert.show("Passed.."+parameters);}
    ]]>
    </mx:Script>
    <mx:Button click="openBrowseWindow();onOpenFileComplete(event)" name="Upload" label="Upload" x="120.5" y="10"/> 
    Here is Mxml Code for Flex Application
    <?xml version="1.0" encoding="utf-8"?><mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns="http://ns.adobe.com/air/application/1.0.M4" >
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert; 
    private function Upload():void{ 
    // CursorManager.setBusyCursor();  
    //var url:String = "HomeAction.do?method=onLoad"; 
    //var url:String = "assets/Air.swf"; 
    var url1:URLRequest = new URLRequest("assets/Air.swf");navigateToURL(url1,
    "_self"); 
    // CursorManager.removeBusyCursor(); }
    ]]>
    </mx:Script>
    <mx:LinkButton id="up" click="Upload()" x="295" y="215" label="UpLoad"/>
    In this code i forward using s url to Open tat  Desktop application but a blank screen appears with out the proper output...
    Please Help me in this to forward AIR from Flex Screen..
    Thanks in Advance
    With Regards
    Gopinath.A
    Software Developer
    First Internet Systems Pvt. Ltd.,
    Chennai

    try this
    http://www.leonardofranca.com/index.php/2009/09/17/launching-an-installed-air-application- from-the-browser/
    regards
    Leonardo França
    Adobe Certified Expert Flex 3 with AIR
    Adobe Certified Expert Rich Internet Application Specialist v1.0
    Adobe Certified Expert Flash CS3 Professional
    Certified Professional Adobe Flex 2 Developer
    Adobe Certified Professional Flash MX 2004 Developer
    http://www.leonardofranca.com
    http://twitter/leofederal
    Manager AUGDF - Adobe User Group do Distrito Federal
    http://www.augdf.com.br
    http://twitter/augdf

  • Calling native code from Flex

    I was wondering, is there any way to call native code from Flex?
    Currently, we're writing browser plugins in order to call native code from a Flex application. However, it would be nice to be able to call native code directly from Flex, so that we could write it only per-platform, as opposed to currently per-platform-per-browser.

    In general, the sandbox does not allow you to access native code from Flex.
    I believe you can use Merapi, but perhaps only for AIR:
    http://www.merapiproject.net/
    You might be able to code around the Flex sandbox, but it would be a ton of work.
    If this post answers your question or helps, please mark it as such.

  • How to open a file in the default application for it directly from QuickLook?

    Is there a way to issue an Open command straight from QuickLook?
    Problem:
    I have a directory containing symlinks to the PDF files I usually refer to. I cannot copy the files locally and I must use symlinks.
    When I need to open one of the files, I can't rely on Finder icon previews as these do not show for symlinks (I think that's absurd, don't you? Is there any reason why they would not?)
    Not knowing how to pick the file I am interested in, I select them all and OPTION+SPACE QuickLook them. Immediately following OPTION+SPACE I press COMMAND+ENTER and finally see them all tiled across the screen (notice: COMMAND+ENTER is not bound in Finder as far as I can see, why not allow users to press that directly?)
    Here's the problem:
    Once I choose the file I want, with the mouse of the arrow keys, I don't see how I could open just that file in the owning application (say: Adobe Reader).
    That, to me, is dumbfounding. COMMAND+O opens ALL files I selected to begin with but I think QuickLook should allow for opening the file currently being previewed with an UI element or a keystroke, shouldn't it?
    It is so strange that it almost can't be, maybe I am just missing the obvious... in that case I apologise.  Feel free to report this to Apple if you think they can work on this.
    For the record, it's the 29th of Aug 2012 and I am on 10.6.8.

    Small update.
    I created a database with a western european characterset We8MSWIn1252
    If I use utl_file to write out the code on the database server it gets produced correctly in Ascii format with the accented charcacters.
    As soon as I try and write out the code using owa_util.Mime_header and htp.p the code is written in UTF8 format.
    I did try and write out the header specifying a western european characterset but it seems that if it encounters an accented character it automatically switches to utf-8 mode. If there are no accented charcters the file is produced in ascii format.
    Really stumped on this one.

  • How to open a pdf in its native reader in iOS using AIR?

    Hi there,
    I am wondering if there is any feasability of opening a pdf directly in its native reader in iOS environment. I needed this to happen from an AIR application.
    I have found that AIR can be extended using a java program to do the above task for Android.
    here is the link: http://www.jamesward.com/2011/05/11/extending-air-for-android/
    Thanks in advance,
    Sris

    Thanks everyone for the solutions.
    After working all the possibilities to open locally saved file on iPad
    1. StageWebView 
    2. navigateToUrl
    3. file.openWithDefaultApplication();
    4. Java socket extension for AIR,
    I finally found a solution.
    StageWebView works on ipad.
    the code that works is as suggested by xperiments.es.fr
    But the problem I faced was saving the pdf and opening the locally saved file.
    Since iOS does not support desktopDirectory & documentDirectory, I tried to save the pdf in applicationDirectory/applicationStorageDirectory, that didnt work when I tried to open the pdf from those locations.
    So the only way was to store the generated PDF in a temporary directory and StageWebView could locate and load that
    It works!!!
    Now the next challenge is, while the desktop (Windows) compilation of the app shows PDF reader with menu options, which does not show on iPad app. IPad app shows just a page index on left-top corner. It would be good if the options are shown as well.
    Lets see!!!
    Cheers,
    Sris

Maybe you are looking for

  • Can't get rid of extra line in div

    can someone check my code on my site www.coloredfortunecookies.com. towards the bottom of the quick order guide there is an extra space in between my pics and the header 2 text in both the jumbo and giant cookie div's.  i can't figure out how to get

  • After install, database is not available. How can I create a new database?

    I installed "Oracle Database 10g Express Edition". After install I tried to "Go To Database Home Page" and received a "Page not found" error. If I run SQLPLUS and ...: connect / as sysdba shutdown immediate startup I get ORACLE instance started. Tota

  • Using Temp Tables

    I'm creating a temp table inside my program. Is there any way to force the database to keep the temp table's contents in memory, rather than flsuhing it to temp disk?

  • KM Custom Reports - Start Button missing??

    hi all, what could be wrong when, after deploying your report into the portal, you miss the report's start button. this happened to me after deploying a custom report that already worked well (after doing little changes on the code like changing para

  • Regarding button on alv screen

    IN the alv grid output i hav to fix the button if user click that button the file has to downloaded how? using function code &ZDL