Getting Flex App Path?

I want to get the full path to where my Flex AIR application
has been installed and is currently running. Back in the Windows
SDK days there was a function called GetModuleFileName. How is this
done in a Flex application?
Thanks,
Steve

Alert.show(File.applicationDirectory.nativePath);

Similar Messages

  • How to get the physical path of my web app root context ?

    Hi,
    I used this code to initialize my LOG4J logger.
            System.out.println(Version + "Servlet context path : " + sctx .getContextPath());
            String path = sctx .getRealPath("/");
            fullyqualifiedlog4jpath = path + "log4j.xml";
            File locallogxml = new File(fullyqualifiedlog4jpath);
            if (locallogxml.exists()) {
                initialized = true;
                DOMConfigurator.configure(fullyqualifiedlog4jpath);
                log = Logger.getLogger(Log4j.class.getName());
                log.info(Version + "Logger initialized");
            else {
                System.out.println(Version + "Unable to locate the log4j.xml file");
            }It works perfectly when running the application with the embedded Jdev11 WLS.
    When deploying the application on a standalone WLS server the path is not returned ;-( I get a null value.
    Does someone has three lines of code which get the physical path of my web app root context?
    Yves

    Changed the methiod used to access log4j.xml.
            FacesContext ctx = FacesContext.getCurrentInstance();
            ServletContext sctx = (ServletContext) ctx.getExternalContext().getContext();
            String contextPath = sctx.getContextPath();
            HttpServletRequest  hsr = (HttpServletRequest)ctx.getExternalContext().getRequest();
            String host = hsr.getServerName();
            int port = hsr.getServerPort();
            try
              String urlstring = "http://" + host + ":" + port + contextPath + "/faces/log4j.xml";
              DOMConfigurator.configure(new URL(urlstring));
              log = Logger.getLogger(Log4j.class.getName());
    .....using the URL s OK.

  • How to get full file path while uploading a file in flex Applications

    How to get full file path while uploading a file in flex applications.
    FileReference Object is giving file name and other details but not the actual path.
    Is there any workaround to to get the file path?.
    Thanks

    Why not ask in the Flex forum; it is more likely that someone over there knows.

  • Flex app calling CF cfc to download file gets "Channel disconnected" fault

    I am a newbie with ColdFusion and Flex. I am trying to implement file download/streaming functionality in my Flex 4.5 application and I am running ColdFusion 9 as my back end. More specifically, I have a component in my Flex app that displays a list of files - some of these files can be available for opening (or "previewing") via the client. I want the client to be able to click a button and download the file from the ColdFusion server, after the appropriate security checks are performed (also in ColdFusion). Right now I am just trying to get the basic download functionality to work with a very simple cfc. Here is the cfc code:
    <cfcomponent displayname="Preview Document"
         output="false">
         <cffunction name="streamFile" access="remote" returntype="any">
              <cfargument name="filename" displayName="Filename" type="string" required="true" />
              <cfheader name="Content-Disposition" value="attachment;filename=#filename#" >
              <cfcontent type="application/unknown" file="c:\myserverpath\#filename#">
         </cffunction>
    </cfcomponent>
    When I try this via a cfm, it works fine (I get a File Download window where I can choose to either open or save the file). But when I try to use this in my Flex app, I get an error.
    In my Flex app, I have a RemoteObject to access my cfc and a CallResponder:
    <s:RemoteObject id="PreviewDocument"
       source="PreviewDocument"
       destination="ColdFusion"
       showBusyCursor="true"/>
      <s:CallResponder id="PreviewDocumentResult"
        fault="Alert.show('CallResponder PreviewDocumentResult: ' +
        event.fault.faultString + '\n' + event.fault.faultDetail)"
        result="PreviewDocumentResult_resultHandler(event)"/>
    Then I created a button whose click even executes the following line:
    PreviewDocumentResult.token = PreviewDocument.streamFile("myfile.pdf");
    When I run my app, I get the following fault:
    faultCode = "Client.Error.DeliveryInDoubt"
    faultString = "Channel disconnected"
    faultDetail = "Channel disconnected before an acknowledgement was received"
    I have tried many different approaches and searched online for help with this fault, but I could not find any helpful clue to where I can start investigating this.
    Can anyone help with why I am getting this fault?
    Thanks in advance.

    @sir_teddy, thanks for your reply again.
    Yes I have created a simple cfc that returns a string successfully (in fact I had used the same cfc and basically just commented out the cfcontent and cfheader tags, and returned the name of the file being requested in the cfreturn tag). When I un-comment the cfcontent tag from the code, the error comes back.
    So I am really at a loss here...

  • How can i get the local path to my cached app in jws

    Hi,
    sorry, i think it is a stupid question of me. but i'm a newbie in java and jws...
    So my question is...
    is it possible to get the absolute path to my downloaded an d cached jarfile? (e.g. c:\program files\java web start\.javaws\cache\http\Dmy.server.com\P80\RMmyapp.jar)
    thanks a lot for any help.

    I just answered this elsewhere, but here it is again.
    This code seems to work. I found it last year in one of the forums.
    I use it to find resources in Jars or to find images when I am in an IDE
    The "SetIcon.class" below should be changed to the class you are running from.
    Note: If you are running a class in a package, this returns the root of your application instead of the "folder" containing your package. This would mean that the "images" folder I refer to below is under the root folder, not the package folder.
    javax.swing.ImageIcon img;
    URL imgPath1;
    String imgPath2;
    imgPath1 = SetIcon.class.getProtectionDomain().getCodeSource().getLocation();
    imgPath2 = imgPath1.toString();
    imgPath2 = imgPath2.substring(6); // strip off the "file:"
    imgPath2 = imgPath2 + "images/sample.gif";
    Hope this helps,
    Hale

  • Flex app doesn't work when moved from original location

    I'm trying to make an image gallery in flex. It works when I run it in Flex Builder perfectly fine. The html and swf files from the bin-debug folder work perfectly fine when opened in any browser also, but ONLY when those files and all related files are opened from the default location that the application was built in. When I export a build to a different folder, the swf loads but none of the information from the xml file displays. I tried setting all of the paths of the reference files (namely the xml) in the flex app to the exact absolute location on the server, and it still didn't work when I uploaded it to the server.
    I've tried several approaches starting from scratch and they have all come up with the same issue. I'm working with an educational license for Flex Builder, I'm not sure if they jip you on those and ruin the compiled swf.
    Please help! I'm losing my mind over this.I think it has to do with something else besides the code since it works fine when I hit "Run", but if anyone thinks it will help to post the code let me know.

    when you build an application using one of the wizards (like coldfusion flex application wizard) it hard codes
    paths to cold fusion CFC's, and sometimes gets it wrong.
    If your application references cfc's (or other remote objects) then it may be necessary to adjust the flex code
    when moving the code into a different base folder.
    For example in my own application, the url is http://localhost/crm_dev_flex and the built application gets put into
    c:\inetpub\wwwroot\crm_dev_flex\bin-debug
    References in the code to components found in c:\inetpub\wwwroot\crm_dev_flex\bin-debug\components\cfgenerated
    (in the flex code these looks like crm_dev_flex.bin-debug.components.cfgenerated.<mycomponent> )
    These need to change when you move the code to somewhere else.
    Also, if you are using wizard generated cfc's then these also contain similar references that need to be changed.
    IHTH.
    Cheers

  • Flex App with remoting works on local Apache server - fails on production server

    Hi Everyone,
    I have a Flex app that uses Data Services. The application works correctly on my local Mac Server and Apache. When uploaded to my production CentOS server, the Data Services fail. When the app is done loading, the following error message comes up:
    Class "ModelsService" does not exist: Plugin by name 'ModelsService' was not found in the registry; used paths:
    : /www/html/mdubb//PHP2/bin-debug/services/
    #0 /var/www/html/mdubb/ZendFramework/library/Zend/Amf/Server.php(550): Zend_Amf_Server->_dispatch('getAllModels', Array, 'ModelsService')
    #1 /var/www/html/mdubb/ZendFramework/library/Zend/Amf/Server.php(626): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))
    #2 /var/www/html/mdubb/PHP2/bin-debug/gateway.php(73): Zend_Amf_Server->handle()
    #3 {main}
    Where getAllModels is a method of my custom ModelsService.
    I changed the Zend path in the amf_config.ini file so it references the correct directory. If I browse to gateway.php, it prompts to download the file, which I think is correct.
    I added in the config file the path to the services folder.
    I tried adding $server->addClass("ModelServices") in gateway.php, but it didn't like that.
    The file structure on the production server is the same as the local server (I litterally uploaded everything in my local web root), so I can't think of what would be differenet between the two.
    I have already pulled one all nighter trying to get this to run. Do you know what I should troubleshoot next?
    Thanks in advance,
    Ryan

    Hi,
    With reference to Lumira 1.15, the minimal SP we support is BI 4.0 SP6. Please upgrade at least to this. Everything is detailed in the PAM https://websmp107.sap-ag.de/~sapidb/011000358700001095842012E
    Best regards,
    Antoine

  • Automating a flex app on a headless server

    I have a flex chart drawing application that needs to be automated. When automated it will read in data from the DB, draw the charts, and save them as .png files. This works flawlessly on my localhost version of oc4j on my Mac. However it has never worked on our Solaris oc4j deployment which is a headless server. I've set flex to run as headless in the config files but no dice. How can I get this working? Here are some of the error messages I'm getting:
    LINUX/UNIX browser attempting to launch /opt/sfw/bin/firefox http://flexdomain.yadayadyada
    08/11/06 14:41:53
    user dir: /usr/local/src/oracle/product/10.1.3.2.0/OracleAS_1/j2ee/home
    08/11/06 14:41:54 ERR>The application 'firefox-bin' lost its connection to the display flexdomain. yadayadyada:1.0;
    08/11/06 14:41:54 ERR>most likely the X server was shut down or you killed/destroyed
    08/11/06 14:41:54 ERR>the application.
    08/11/06 14:41:54 ExitValue: 1
    And here's a snippet from the Java which launches the flex app in the firefox browser:
    String cmd = "/opt/sfw/bin/ff.sh "+ url; // ff.sh is a script which sets DISPLAY and launches firefox with the flex url
    Runtime rt = Runtime.getRuntime();
    Process p = rt.exec(cmd);
    I'm using 10g, by the way.
    Thanks!
    Edited by: Solerous on Nov 7, 2008 7:04 AM

    Ok, I'm convinced that this is some sort of configuration problem. I can get the browser to launch when written as a simple java program compiled at the command line:
    import java.util.*;
    import java.io.*;
    public class Launcher {
    public static void main(String args[]) throws IOException {
    String url = "http://www.ebay.com";
    String[] commands = {"/bin/sh", "-c", "/opt/sfw/bin/firefox ", url, "-width", "1600", "-height", "1200", ":5"};
    ProcessBuilder pb = new ProcessBuilder(commands);
    Map<String, String> env = pb.environment();
    env.put( "DISPLAY", ":5" );
    Iterator it = env.entrySet().iterator();
    while (it.hasNext()) {
    Map.Entry pairs = (Map.Entry)it.next();
    System.out.println("\t>> environ: "+pairs.getKey() + " = " + pairs.getValue());
    Process process = pb.start();
    The output is just to show the environment variables and it looks like this:
         >> environ: XFILESEARCHPATH = /usr/dt/app-defaults/%L/Dt
    >> environ: LANG = C
    >> environ: DISPLAY = :5
    >> environ: ORACLE_BASE = /oracle
    >> environ: ORACLE_TERM = vt100
    >> environ: PWD = /usr/local/u00/de8
    >> environ: _ = /usr/bin/java
    >> environ: MAGICK_HOME = /usr/ImageMagicK/ImageMagick-6.4.4
    >> environ: ORACLE_SID = cots
    >> environ: USER = de8
    >> environ: NLSPATH = /usr/dt/lib/nls/msg/%L/%N.cat
    >> environ: EDITOR = /bin/vi
    >> environ: MOZILLA_SOLARIS_PATCHCHECKER = disable_patchchecker
    >> environ: HOME = /u00/de8
    >> environ: SSH_CONNECTION = 128.219.196.118 64994 160.91.230.33 22
    >> environ: LD_LIBRARY_PATH = /usr/jdk/instances/jdk1.5.0/jre/lib/sparc/server:/usr/jdk/instances/jdk1.5.0/jre/lib/sparc:/usr/jdk/instances/jdk1.5.0/jre/../lib/sparc:/opt/SUNWspro/lib:/usr/openwin/lib:/usr/dt/lib:/usr/ImageMagicK/ImageMagick-6.4.4/lib::/oracle/product/9.2.0/lib
    >> environ: LOGNAME = de8
    >> environ: SHELL = /bin/ksh
    >> environ: ORACLE_HOME = /oracle/product/10.1.3.2.0/OracleAS_1
    >> environ: SSH_TTY = /dev/pts/1
    >> environ: MAILMSG = [YOU HAVE NEW MAIL]
    >> environ: MANPATH = /usr/opt/SUNWmd/man:/usr/man:/usr/local/man:/usr/share/man:
    >> environ: NNTPSERVER = time.ornl.gov
    >> environ: SSH_CLIENT = 128.219.196.118 64994 22
    >> environ: MAIL = /var/mail/de8
    >> environ: TZ = US/Eastern
    >> environ: PS1 = ${PWD###/} $
    >> environ: TERM = vt100
    >> environ: PATH = /oracle/product/10.1.3.2.0/OracleAS_1:/oracle/product/10.1.3.2.0/OracleAS_1/OPatch:/usr/xpg4/bin:/usr/ccs/bin:/usr/local/bin:/usr/bin:/usr/ucb:/etc:/usr/sbin:/u00/de8/bin:/opt/NSCPcom:/sbin:/usr/local/etc:/usr/lib:/usr/opt/SUNWmd/sbin:/usr/bin:/usr/local/bin/perl5.00502:/usr/openwin/bin:/opt/sfw/bin:/usr/ImageMagicK/ImageMagick-6.4.4/bin:.:/oracle/product/9.2.0/bin
    I decided to output the env vars in hopes that it would show what needs to be reset. But if I use the exact same code in my deployment, it fails and I get the following env settings:
    08/12/09 14:14:27 >> environ: XFILESEARCHPATH = /usr/dt/app-defaults/%L/Dt
    08/12/09 14:14:27 >> environ: LANG = C
    08/12/09 14:14:27 >> environ: DISPLAY = :5
    08/12/09 14:14:27 >> environ: ORACLE_CONFIG_HOME = /oracle/product/10.1.3.2.0/OracleAS_1
    08/12/09 14:14:27 >> environ: NLSPATH = /usr/dt/lib/nls/msg/%L/%N.cat
    08/12/09 14:14:27 >> environ: TMP = /tmp
    08/12/09 14:14:27 >> environ: TZ = US/Eastern
    08/12/09 14:14:27 >> environ: NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252
    08/12/09 14:14:27 >> environ: ORA_NLS33 = /oracle/product/10.1.3.2.0/OracleAS_1/ocommon/nls/admin/data
    08/12/09 14:14:27 >> environ: LD_LIBRARY_PATH = /usr/local/src/oracle/product/10.1.3.2.0/OracleAS_1/jdk/jre/lib/sparc/server:/usr/local/src/oracle/product/10.1.3.2.0/OracleAS_1/jdk/jre/lib/sparc:/usr/local/src/oracle/product/10.1.3.2.0/OracleAS_1/jdk/jre/../lib/sparc:/oracle/product/10.1.3.2.0/OracleAS_1/opmn/lib:/oracle/product/10.1.3.2.0/OracleAS_1/lib32
    08/12/09 14:14:27 >> environ: X_LD_LIBRARY_PATH_64 = /oracle/product/10.1.3.2.0/OracleAS_1/lib
    08/12/09 14:14:27 >> environ: ORACLE_HOME = /oracle/product/10.1.3.2.0/OracleAS_1
    08/12/09 14:14:27 >> environ: SHELL = /bin/bash
    Does anyone know how I can get the deployed version (running in the server container) to work exactly in the same way as the version run from a simple command line?

  • Should I learn Fireworks or Builder to Design Flex Apps?

    I need help in making a process decision on how to build Flex
    Apps going forward.
    In the past, we have built the concept for our Flex app in
    Photoshop and sent it over to our development team in India to
    build. The process has been difficult because our engineers are not
    designers and our designers are not engineers. Invariably we spend
    alot of time bridging the gap between whats possible and what we
    want to see in our Apps.
    I want to bring our Design and Dev much closer together and
    essentially take the GUI out of the hands of my Indian Developers
    and let them focus on the backend.
    To accomplish this goal, I will be training my US Design team
    to become either Fireworks Experts or Flex Builder Experts....
    (they are already Photoshop experts) This is where I need your
    help. If you were starting from scratch with a talented design team
    that could learn either tool, which one would you choose to
    accomplish the goal? Does the Fireworks to Flex export create
    crappy code like Dreamweaver thats tough to modify manually? Does a
    "true" Flex developer despise Fireworks-generated code?
    I have read up on the Fireworks>Flash Catalyst>Flex
    Builder Path and dont understand the additional step... is Catalyst
    part of Fireworks and thats how Flex code is developed or is it a
    new code generation engine that does code better than Fireworks
    CS4?
    Thanks in advance.

    I am understanding my question better now... Please read
    below
    I am attempting to remove inefficiencies in my Flex
    development process by re-tooling my design team so that their UI
    and application design output files can be imported directly into
    the developers environment. Essentially, I want designers to
    produce prototypes with working client-side interactions while the
    developers focus on back-end interactions.
    Our current process has a number of throwaways that occur
    during the web application build process: from wireframe, to
    Photoshop, to development using the Photoshop output as a guide for
    development... this last step is often the most mangled because is
    difficult to implement the design exactly as the designer created
    it in Photoshop because designers do not fully understand what is
    possible. I want to remove the steps in-between and have found two
    possible solutions to do this.
    Option 1) Fireworks CS4>Catalyst(Thermo)>Flex4
    SDK>*.SWF
    Option 2) Fireworks>Flex3 SDK>*.SWF
    With Option 1, we would tool up our Designers on Fireworks
    and Catalyst and get our developers on the Flex4 SDK. The output of
    the design/build would be only compatible with Flash10 and the
    stock component library for Flex4 would be limited.
    With Option 2, we would tool up our Designers on Fireworks
    and use the native Fireworks export to Flex 3 (not sure how well
    this works?). The output would be compatible with Flash 9 and the
    stock and aftermarket component library for Flex3 would be rich.
    Do I have this right? Which option would you choose and why?
    Thanks in advance.

  • Where I can get flex-config.xml in Linux machine

    Hell All,
    We are using Linux machine as OS for portal.
    Normally we can get flex-config.xml at UNIX machine atj2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\portalapps\co
    m.sap.vc.mmcompiler\res\root\WEB-INF\flex\flex-config.xml location in UNIX machine.
    But irj is not there is Linux machine.
    Can anybody help me?
    Regards,
    Sonal Dubey

    Hi Sonal,
    As mentioned in the SAP note 886209, that is the route to find this file, what i recommend you is to check the Server in this path ... \cluster\*server0*\apps\sap...
    Kind Regards,
    Luis

  • Deployment of Flex app to web and app server

    Hi
    I'm working on putting a Flex front-end on an existing J2EE
    app which gets deployed as an ear file. The architecture consists
    of web server, app server and database server. Is the following
    approach to deployment possible / recommended?
    My Flex app will be deployed to the web server. The J2EE ear
    file will be deployed to the app server (Weblogic). BlazeDS will be
    bundled within the ear file as a war file. Remote Objects will be
    configured in my BlazeDS configuration files to enable me to access
    the code in my J2EE app. In the compiler options of my Flex app,
    I'll be setting the server root folder and server root URL to point
    to the BlazeDS war file on my app server.
    At present I'm at the stage where I can run my Flex app
    directly from Flex builder on my development PC and it's able to
    connect tto the J2EE app, which is running on the app server
    (Weblogic) also on my development PC. I can't find documentation
    explaining how to extend this to work on a multi-tier architecture.
    Thanks
    David

    Hi,
    I replied to your post in FDS forum. Please visit the URL
    below for the response.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=583&threadid=1373523
    Hope this helps.

  • How to get the absolute path of logicalhost server domain on Windows Sun

    i am reading a file from Xsql Folder, that is located in the logicalhost Sun\AppServer\domains\domain1\applications\j2ee-apps.(IN Sun Application Server)
    I am pretty sure that using the absolute path will solve this issue, so my first question is: How to get the absolute path of logicalhost server domain on Windows?
    i tried with System.getProperty("com.sun.aas.instanceRoot").
    but i am able to retrive Sun\AppServer\domains\domain1 upto this .i am unable to retrive Sun\AppServer\domains\domain1\applications\j2ee-apps.
    please suggest me how u can get absolute path in sun application server

    Take a look here

  • Adobe AIR Needed on Android / iOS to Run Adobe Flex Apps

    Hi all,
    I want to confirm if the user has to install Adobe AIR before launching Adobe Flex apps on Android and iOS Devices. Is there any way that we could embedd Adobe AIR setup in the app file so that the user dont have to hastle in installing Adobe AIR.
    Taimur

    It gives you only three options:
    Signed packages for each target platform.
    Signed AIR package for installation on desktop.
    Intermediate AIRI package that must be signed later.
    For mobile apps, we need to select the first option to get the .apk and .ipa file as the second option would generate .air file. None of the options offer to package AIR runtime. Only the first option gives you the option on NEXT window to include the download link of AIR Runtime.
    If i am wrong, kindly point me to that specific checkbox.
    OR do i have to put Runtime.apk in the assets folder of my source code so that it gets packaged?

  • Loading purchased swf into Flash Builder 4 Flex app

    I have purchased a Flash "fundraising thermometer" from an online Flash components site. It takes input from an xml file and displays a thermometer with the goal at the top and the current amount raised indicated. It came with the following files:
    thermometer.swf
    thermometer01.fla
    thermometer01.html (A sample that works.)
    xml/thermometer.xml (The source file: goal amount, current amount, mark interval, etc.)
    caurina/transitions (Mostly .as files.)
    Since the test html (thermometer01.html) works fine, I thought this would be a no-brainer.
    I first unzipped the files into a "thermometer" folder in my current project. I then went into Flash Builder and created a SWFLoader object as follows:
    <mx:SWFLoader 
    id="myLoader" source="../thermometer/thermometer.swf" complete="initThermometer();" autoLoad="true" scaleContent="false"/>\
     private function initThermometer():void { 
         Alert.show('Thermometer loaded');
    The Design view looks fine. I can see the thermometer default image (see below).
    When I run the app, I get no errors, just a broken image link in a box (see below). The alert box also never shows up.
    I'm new to Flex, so I may be doing something stupid that keeps this from working. I contacted the author of the thermometer widget but he doesn't know anything about Flex.
    Any help figuring out how to get this to work in a flex app would be appreciated.

    You should probably add more event handlers to see what's going on.  Especially "ioError". The complete list is below.  For coverage, add a handler for each event. You can also use in MXML
         complete="initThermometer(event)
    and add an argument to your Actionscript method, to find out details about the event.
    private function initThermometer(event:Event):void { 
         Alert.show('Thermometer loaded ' + event.type);}
    Events
        complete="No default"
        httpStatus="No default"
        init="No default"
        ioError="No default"
        open="No default"
        progress="No default"
        securityError="No default"
        unload="No default
    General info here:
         http://livedocs.adobe.com/flex/3/langref/mx/controls/SWFLoader.html
    I did not test my code suggestions, but it's probably close.

  • Why would I need to use LiveCycle Data Services in a Flex app?

    I cannot figure out what additional functionality is provided by using LiveCycle Data Services in my Flex apps.  I cannot get a clear understanding of how using LiveCycle Data Services would benefit my applications.  Does someone out there use LiveCycle Data Services?  If so, what do you do with it in Flex?
    Thanks!

    - data push for publish/subscribe implementations
    User has to do nothing to get updated information. You push it to their machine when new data is available, like Yahoo finance updated quotes.
    - data paging
    You don't want to display one million rows in your datagrid at once. Get a batch of data, if the user scrolls down, get the next batch, etc.
    - server side clustering
    One server does not get overloaded. High traffic sites have their large number of concurrent connections managed more efficiently.
    - JMS services
    JMS is a powerful technology for messaging throughout an application, and LCDS makes it much easier.
    - RTMP tunneling
    Allows the use of the RTMP protocol in LiveCycle Data Services applications. Makes it easier to traverse firewalls and proxies appropriately that currently prevent direct RTMP client connections to the server.
    If this post answered your question or helped, please mark it as such.

Maybe you are looking for