How to find a file in application bean

Hi everyone,
I need to read in a file in application bean. But I could not figure out the relative path from application bean to my file.
Currently I have to use absolute path. However, it does not make sense to use absolute path because it will change after deployment.
Could you tell me where I should put my file in JSC 2 and what is the relative path from application bean to it?
I know how to do it in .jsp pages. But it seems to be different if I read it from application bean.
Thanks in advance,

Do you mean this code did not work.
ServletContext theApplicationsServletContext =
(ServletContext) this.getExternalContext().getContext();
String realPath =
theApplicationsServletContext.getRealPath
("/resources/images");
File file = new File(realPath + File.separatorChar +
justFileName);
Works for me. I've used it in my blog
http://blogs.sun.com/roller/page/winston?entry=how_to_create_a_file
- Winston

Similar Messages

  • How to save CSV file in application server while making infospoke

    How to save CSV file in application server to be used as destination while making infospoke.
    Please give the steps.........

    Hi
    If you want to load your flatfile from Application server,then you need to trasfer your file from your desktop(Computer) to Application server by using FTP.
    Try using ARCHIVFILE_CLIENT_TO_SERVER Function module.
    You Just need to give thesource path and the target path
    goto SE37 t-code , which is Function module screen, give the function name ARCHIVFILE_CLIENT_TO_SERVER, on click F8 Execute button.
    for path variable give the file path where it resides like C:\users\xxx\desktop\test.csv
    for target path give the directory path on Application server: /data/bi_data
    remember the directory in Server starts with /.
    U have to where to place the file.
    Otherwise use 3rd party tools to connect to ur appl server like : Core FTP and Absolute FTP in google.
    Otherwise...
    Goto the T.code AL11. From there, you can find the directories available in the Application Server.
    For example, if you wanna save the file in the directory "DIR_HOME", then you can find the path of the directories in the nearby column. With the help of this, you can specify the target path. Specify the target path with directory name followed by the filename with .CSV extension.
    Hope this helps
    regards
    gaurav

  • How to find the file that delete from time capsule?

    How to find the file that delete from time capsule?

    I mean I saved JPEG file in Time capsule and unfortunately delete the file. Can I get it back
    IF.... .no other backups have occured since you deleted the file, you might be able to retrieve it using an application like Disk Warrior. It's about $100 as I recall, and there are no guarantees that it will work.
    DiskWarrior 4 - The Disk Utility for Mac  Disk Repair, Mac Directory ...
    Any of the free or low priced utilities that you might see or try will not be able to retrieve a deleted file from a Time Capsule.
    If any backups have occured since you deleted the file, the deleted file has almost certainly been overwritten. No way to retrieve it in that case.

  • How to find 11i and r12 applications characterset

    Hi,
    How to find 11i and r12 applications characterset not of database only applications,What is IANA characterset asked in rapid install?How to find IANA character set in 11i and r12
    Regards

    Hi,
    How to find 11i and r12 applications characterset not of database only applicationsAs applmgr user, source the application env file and issue "echo $NLS_LANG".
    You can also get it from the application context file (search for <NLS_LANG oa_var="s_nlslang">).
    What is IANA characterset asked in rapid install?How to find IANA character set in 11i and r12This is documented in the installation manual.
    The IANA (Internet Assigned Numbers Authority) character set is the Internet-assigned standard character set name used by the Web server. See http://www.iana.org/assignments/character-sets for more information.
    Regards,
    Hussein

  • How to find log files in Sun soalries....

    How to find log files in the SUN Solaries Os if there is any.....
    i am new to SUN Solaries Admin Can some one refer me a good book for me on sun solaries
    Thankq

    A reasonable method would be
    cat /etc/syslog.conf
    .. at least it would show you where syslog send its logs.
    .7/M.

  • How to upload XML file from Application server.

    Hi,
    How to upload XML file from Application server.Please tell me as early as possible.
    Regards,
    Sagar.

    Hi,
    parameters : p_file type ibipparms-path obligatory.
    ***DOWNLOAD---->SAP INTO EXCEL
    filename1 = p_file.
    call function 'GUI_DOWNLOAD'
      exporting
      BIN_FILESIZE                    =
        filename                        = filename1
        filetype                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = 'X'
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
      tables
        data_tab                        = it_stock
      FIELDNAMES                      =
    exceptions
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       others                          = 22
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Regards,
    Deepthi.

  • How to rename a file in Application server

    Hi All,
    Here I have a issue with  the present file which is being generated in application server.
    Before the completion of the file the EDI tool is extracting the file from the app server.So here I would like to generate the file with a temp name and then rename to the actual file name which EDI recognises and fetches.
    Please correct me If I am wrong and let me know how to rename the file in application server.
    Thanks,
    Vijay N

    you can try using unix command , if your application server is unix.
    use move command
    mv   <source>  <target>
    REPORT ZUNIX line-size 400
                    no standard page heading.
    data: unixcom like   rlgrap-filename.  
    unixcom = 'mv file1 file2'.
    data: begin of tabl occurs 500,
            line(400),
          end of tabl.
    data: lines type i.
    start-of-selection.
      refresh tabl.
      call 'SYSTEM' id 'COMMAND' field unixcom
                    id 'TAB'     field tabl[].
    or else you can open dataset/ read the dataset and move it to another file and delete the old file.

  • How to find the File name using the FTP Adapter

    hi all,
    how to find the File name using the FTP Adapter with BPEL.
    Regards

    Found the solution for this.
    First In the mediator's routing rule use assign property $in.property.jca.file.FileName to $out.property.jca.file.FileName
    In the BPEL's receive activity go to the properties tab and get the property to a BPEL variable. That should do it.
    Thanks for the posts

  • Question about how javac finds referenced files.

    Hi
    I am just beginning to learn Java and have got some questions related to packages.
    I have two classes:
    MyClass.java
    package pkg;
    public class MyClass {
         public void prn(int x){
         System.out.println("Integer: "+x);
    Test.java
    import pkg.*;
    public class Test{
         public static void main(String[] args){
              MyClass obj=new MyClass();
              obj.prn(2);
    Directory structure
    /root/ jprog/MyClass.java
    /root/ jprog/Test.java
    Executing the following sequence of commands gives me:
    # ls
    MyClass.java Test.java
    # javac -d . MyClass.java
    # ls
    MyClass.java Test.java pkg/
    # cd pkg
    # ls
    MyClass.class -----compiles.
    # cd ..
    # javac Test.java
    Test.java:5: cannot access MyClass
    bad class file: ./MyClass.java
    file does not contain class MyClass
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    MyClass obj=new MyClass();
    ^
    1 error
    Now after reading another thread on this forum I came to know that the compiler finds the
    MyClass.java in the wrong package. Using verbose option with javac shows this.
    So I move it to some other directory and everything works.
    # mv MyClass.java /root
    # ls
    Test.java pkg/
    # javac Test.java
    # java Test
    Integer: 2
    Now the question begins:
    Suppose we go back to how the files were arranged before I moved the MyClass.java file and
    I change the Test.java file by adding
    package pkg2;
    statement to it.
    Now everything compiles
    # ls
    MyClass.java Test.java ---I have deleted pkg and .class files
    # cat Test.java
    package pkg2;
    import pkg.*;
    public class Test{
    public static void main(String[] args){
    MyClass obj=new MyClass();
    obj.prn(2);
    # cat MyClass.java
    package pkg;
    public class MyClass {
    public void prn(int x){
    System.out.println("Integer: "+x);
    # javac -d . MyClass.java
    # javac -d . Test.java
    # ls
    MyClass.java Test.java pkg/ pkg2/
    # java pkg2.Test
    Integer: 2
    Why isn't the MyClass.java file causing any problems now?
    Using the verbose option with javac shows that the compiler goes straight for the pkg/MyClass.class.
    My readings of Core Java Horstmann tell me that the compiler always looks in the current directory. javac documentation also doesn't help. I know that the documentation recommends that the source file locations should match the package statements.
    I'm just trying to learn how javac finds referenced files.
    Any help??
    Thanks a load in advance.

    I know that the
    documentation recommends that the source file
    locations should match the package statements.This is not merely a recommendation, it is a requirement.
    Both javac and java find classes by traversing the classpath. The classpath should contain directories (or jar files) that correspond to the top of a (part of the) package hierarchy.
    For example, if the Java code for your class is in a file C:\src\pkg\MyClass.java, and MyClass.java declares the class to be in package pkg, the classpath should contain C:\src. Classes are then found by transforming their package declaration into a directory structure.
    Please note that javac works on files, not classes. Therefore it is necessary to specify the full filenames of the files you want to compile, even if you have specified the classpath. By default, javac will put compiled class files in the same location as their sources, so the classpath for the java command should also contain C:\src.
    The exception to the rule is when all classes for the program are in the default package (i.e., they do NOT contain a package statement). In that case, it is possible for javac (and I believe java as well) to find all classes in the current directory, so it will "just work".
    You can specify the classpath using the -cp parameter to both javac and java.
    Hope this helps.

  • How to find .pld files version in Oracle apps

    Hi,
    How to find .pld file version in Oracle apps using unix command or any other way.
    Regards

    Connect to the forms server.
    In the $AU_TOP/resource directory run the following...
    strings -a <NAMEOFFILE>.plx | grep '$Header'
    For example...
    To find the .pld version of INVAMCAP.plx I would run this on the forms server.
    cd $AU_TOP/resource
    strings -a INVAMCAP.plx | grep '$Header'
    This will return the .pld version.
    Hope this helps!
    Jen

  • How to find duplicate files in Finder with Automator or Apple ScriptEditor

    Can anyone tell me how to find duplicate files in Finder with Automator or Apple ScriptEditor.

    D'oh!  It's actually fairly easy - I just right clicked on the file, Get Info, Artwork tab, then dragged the picture to the desktop, from where I can do what I like with it.  Never mind, nothing to see here, carry on.

  • I have an app on my iPhone that I want to download on my iPad . Red icon with Chinese writing. Because I do not speak Chinese I do not know how to find it. The application is photography by different individuals of their vacations/trips. Can someone help

    I have an app on my iPhone that I want to download on my iPad . Red icon with Chinese writing. Because I do not speak Chinese I do not know how to find it. The application is photography by different individuals of their vacations/trips. Can someone help

    On your iPad  go to the App Store icon, Tap on the Purchased Tab.
    It will show you all the Apps that have been bought with the Apple Id currently in use by the iPad.
    Assuming its the same one being used on the iPhone, you should be able to find the App there.
    To further help you find it you can tap on the "Not on this iPad" button to limit the results to just Apps not currenlty installed on your iPad.

  • How to find if a SAP Application uses Shared server process ??

    Hi,
    Please find the details below wrt to SAP application:
    SAP Release : SAP ECC 6.0
    Oracle database Version : 10.2.0.4.0
    Can you please tell me how to find if my SAP application  with oracle  uses Shared server mode or Dedicated server mode for oracle database access??
    regards,
    Arul S

    Hi Nick,
    Thanks for your reply.
    I am also pasting the output of "lsnrctl services"
    LSNRCTL for HPUX: Version 10.2.0.4.0 - Production
    Copyright (c) 1991, 2007, Oracle.  All rights reserved.
    Connecting to (ADDRESS=(PROTOCOL=IPC)(KEY=R1Q.WORLD))
    Services Summary...
    Service "R1Q" has 1 instance(s).
      Instance "R1Q", status UNKNOWN, has 2 handler(s) for this service...
        Handler(s):
          "DEDICATED" established:0 refused:0
             LOCAL SERVER
          "DEDICATED" established:269921 refused:0
             LOCAL SERVER
    The command completed successfully
    This looks like dedicated connection with the Oracle database..
    Can you please comment on this?
    Regards,
    Arul S

  • How to find the list of applications registered with OID?

    Could some one please help me?
    how to find the list of applications registered with OID?

    Is there any table from which we would be able to see?

  • How to find lost files from Iphone without back up

    How to find lost files from iPhone without back up?

    If you don't have a back up, there's no where to restore them from.

Maybe you are looking for

  • Authorization to restrict G/L Account

    Dear All I am looking to restirct postings to GL account based on the user in T Code F-02. Can any one highlight which authorization objects can i use to restrict user for posting to GLs and Cost Elements Your valuable input is required in this aspec

  • Networking - Why Doesn't This Work?

    Hey all Just wondering if any of you have any ideas why this code isn't working properly - for the Client to connect the Server has to be restarted. Is there a solution to this problem? The Client Class: import java.awt.Container; import java.awt.Col

  • I am getting calendar notifications for others calendars on my iphone

    Ever since I updated to IOS8, I have been getting calendar notifications from my boss's calendar on my iphone 5.  I have his calendar as a secondary calendar so I can schedule appointments with him as needed.  His is the only secondary calendar that

  • Has anyone looked into starting a class action laws

    Just like the title says . Has anyone checked into this to see if there is one starting up. i was at the store yesterday and all of creatives cards on the self had vista compat. stickers on them NOW WE ALL KNOW THIS ISNT TRUE. AND SO DOES CREATIVE

  • Why hasn't Adobe fixed the "disappearing form data" problem???

    I am using Acrobat 9.2 and people are emailing me a fillable, savable form that I CAN'T READ WHEN I GET IT!  What the...? I'm using Windows 7. The PDF form opens blank and I can only see what the user typed in if I click on one of the fields.  When I