How to get the actual path of a file present in the Web content folder

I have a jasper file which is present inside the Web-Content folder of my project.
I need to pass this file as an argument to the FileInputStream object. How can i give the actual path of the jasper file, since this project can be deployed anywhere else also.

You may be able to use the getRealPath or getResource methods in ServletContext

Similar Messages

  • How to get rid of extra browser support files without hosing the web help

    I produce web help for a a web app that is restricted to IE.
    When I generate web help, RH spits out dozens of files that support
    help within other browsers. We tried deleting these "extra" files,
    but it hosed the help. Does anyone know of a way to either 1)
    generate without these files or 2) remove the files without
    breaking web help?

    Welcome to our community, Karen
    If you took them out and it hosed the help, it would seem
    they are actually serving *SOME* function, no?
    I'd simply ignore things and just accept the fact that you
    get a lot of files with WebHelp.
    Cheers... Rick

  • How to get the Real Path of a file which is accessed  by URL?

    iam using tomcat6.0.
    I have a file xyz.xml at the top of the webapplication HFUSE which i can able to access by URL
    http://localhost:8080/HFUSE/xyz.xml
    My problem is how to get the realpath of the file "xyz.xml" for reading and writing purposes.
    I tried various things but i could not able to successfully solved the problem?
    1) File f = new File("/xyz.xml");
    print(f.getAbsolutePath()) ============== it is not fetching the file @ http://localhost:8080/HFUSE/xyz.xml rather it is creating a file
    at the root of the drive where eclipse is running.
    2) File f = new File("xyz.xml");============> this is also not working , it is creating the file xyz.xml in the eclipse directory ..................
    Can anyone please guide on this problem?

    RevertInIslam wrote:
    If you want your context root(i.e HFUSE)
    use this:
    request.getContextPath() //where request is HttpServletRequest object to get the needful path.
    e.g:
    File f = new File(request.getContextPath()+"/xyz.xml");//it will create the file inside HFUSE.
    Hope this helps.
    Regards
    BWrong. The File constructor expects an absolute filesystem path. The HttpServletRequest#getContextPath() doesn't return the absolute filesystem path, it only returns the relative path from the current context root. Use ServletContext#getRealPath() instead, it returns the absolute filesystem path for the given relative path from the current context root.
    File file = new File(servletContext.getRealPath("/"), "xyz.xml");

  • How to get the absolute path of a file from the local disk given the file n

    how to get the absolute path of a file from the local disk given the file name

    // will look for the file at the current working directory
    // this is wherever you start the Java application (cound be C: and your
    // application is located in C:/myapp, but the working dir is C:/
    File file = new File("README.txt"); 
    if (file != null && file.exists())
        String absolutePath = file.getAbsolutePath();

  • Sharepoint Workflow : how to get document full path + file name into variable?

    Hi,
    Anybody knows how to get document full path + file name into a variable in Sharepoint 2010 workflow?
    Example http://sp1:80/InvoiceQueue/Shared Documents/123.pdf
    I am using List Workflow which links to a document library.

    Hi SAMSUNG,
    According to your description, my understanding is that you want to get the full path of a document in a list workflow.
    You can set the variable to the Enconded Absolute URL of the document. The screenshot is my testing. In my testing (in the red area), when the title of a document was equal to the tile of the current item, set a variable to the Enconded Absolute URL of the
    document. I used ‘Log to history list’ to check the value of the variable in Workflow History .
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • How do I use a path as an argument without breaking the -classpath option?

    How do I use a path as an argument without breaking the -classpath option?
    I have the following Korn Shell Script:
    #!/bin/ksh
        CSVFILE=/EAIStorageNumbers/v1/0001/weekly05222006.csv
        OUTPUTFILE=/EAIStorageNumbers/v1/0001/08000000.txt
        PAGEMBR=0800F341
        cd /EAIStorageNumbers/v1/bin/
        java -classpath com.dtn.refinedfuels.EAIStorageNumbers $CSVFILE $OUTPUTFILE $PAGEMBRWhen I run the shell script, I return the following error:
    Exception in thread "main" java.lang.NoClassDefFoundError: /EAIStorageNumbers/v1/0001/weekly05222006/csv
    Thus, the -classpath option sees the first argument as a classpath. When I remove the -classpath option, I get a different error, which is another issue:
    Exception in thread "main" java.lang.NoClassDefFoundError: au/com/bytecode/opencsv/CSVReader
    at com.dtn.refinedfuels.EAIStorageNumbers.main(Unknown Source)
    Thoughts or suggestions on how I can get the -classpath option to work with the defined Korn Shell Script variables would be greatly appreciated.

    I think you're misunderstanding the classpath argument. This tells java where to look to find your classes. The argument you're supplying looks like the class that you want java to run. Run something like this: java -classpath $MY_CLASS_DIR my.package.MyClass arg1 arg2 arg3.

  • When we get the actual data in BPC for planning, is the data consolidated

    I had a question regarding Planning. When we get the actual data in BPC for planning, is the data consolidated? Do we need to run the consolidation business rules( IC Booking, Matching, IC Eliminations) on the data before we can use it for planning? Per my understanding we have to run Currency Conversion on this...correct?
    Also, where do I get my actual data from? Does ECC/ Source system have data from all entities( CHQ, Region and Countries)?
    Please help!
    Thanks in advance

    Hi Kimi,
    In a hierarchical structure, the data is always loaded in to the base level, and the data is automatically rolled up to its parents.
    The currency conversion will also take place at the base level, and as mentioned earlier, the converted data will also be rolled up as per the hierarchy.
    The heading of this thread says planning. So, ideally, there wont be any legal (or statutory) consolidation. You might use the US elimination however, for eliminating the intercompany transactions, if any.
    The planning can be done as zero based (wherein the user has to enter the planned data manually from scratch) or non-zero based (wherein the planned data of previous year is copied and the user can change the data as required).
    The flow of events cannot be suggested by us. It has to be discussed with the business to understand how do they do the planning.
    Hope this helps.

  • TS1717 iTunes will not open.  I get a message that says, "The iTunes Library.itl file cannot be found or created.  The default location for this file is in the "iTunes" folder in the music folder."  How can I fixt this?

    iTunes will not open.  I get a message that says, "The iTunes Library.itl file cannot be found or created.  The default location for this file is in the "iTunes" folder in the music folder".  How can I fix this?

    Hi pgarard1,
    If you are having issues with launching iTunes after an update, you may want to take a look at the troubleshooting in the following article:
    iTunes for Windows: Doesn't open after upgrading in Windows Vista or Windows 7
    http://support.apple.com/kb/TS2363
    Regards,
    - Brenden

  • My mini died. bought one used from a friend... all of my songs and books are on my iPhone, and I cant figure out how to get them onto this new computer. this is frustrating. the things i really want are purchases I've made from itunes store... help

    My mini died. bought one used from a friend... all of my songs and books are on my iPhone, and I cant figure out how to get them onto this new computer. this is frustrating. the things i really want are purchases I've made from itunes store... help
    !!!!!

    Hey kevyg3,
    I was able to find an article that I believe will help you move your iTunes purchases from your iPhone over to your new computer:
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    http://support.apple.com/kb/HT1848
    Hope this helps,
    David

  • I recently purchased songs from itunes via my pc and I dont know how to get them onto my iphone? When I click the sync button it says I will lose all the music currently on my iphone.. Help :(

    I recently purchased songs from itunes via my pc and I dont know how to get them onto my iphone? When I click the sync button it says I will lose all the music currently on my iphone.. Help

    If you're syncing with a different iTunes library than the one you previously synced with, then there is no way around it. You're gonna loose the old data. The only way round it would be to make sure that all the music files on your iPhone is also in your iTunes library. If you still have access to the computer with the old library, you could copy the files on to an external harddrive, and then import them into your new iTunes library.
    If it is in fact the same library, then the music currently on your iphone, is also in your itunes library. Just make sure that the artists/albums/playlists, or whatever you sync contains these tracks, that you allready have on your phone and don't want deleted. What i do is, i create a playlist specifically for my iPhone, and i set it up to only sync with this playlist. Whenever i hear a track from my iTunes library or buy a new track that i want on my phone, i just drag it to this playlist and next time i synchronize, it's there without deleting anything else.

  • Photoshop elements 10 will not migrate to my new macbook pro/retina display.  There is no CD/DVD player on this machine.  Any suggestions on how to get Elements onto my machine?  Yes, I have the disk(s).

    Photoshop elements 10 will not migrate to my new macbook pro/retina display.  There is no CD/DVD player on this machine.  Any suggestions on how to get Elements onto my machine?  Yes, I have the disk(s).  Am I going to have to buy an external CD/DVD player to load this one program:(

    I have ordered a USB3 BluRay/DVD/CD player/burner and will use that both with my iMac ( in which the Superdrive seems to be failing ) and the MBPro Retina I just bought .

  • TS2755 How do get my mail on my ipad 3 to set the same email rules as is on my imac ???

    How do get my mail on my ipad 3 to set the same email rules as is on my imac ???

    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    iPad Mail
    http://www.apple.com/support/ipad/mail/
     Cheers, Tom

  • My ipod touch 4 gen is in recovery mode and i dont know how to get out of it,i tried everything like hold the home and top button at the same time. All it did what g to the apple logo and went back to recovery mode any help?

    My ipod touch 4 gen is in recovery mode and i dont know how to get out of it,i tried everything like hold the home and top button at the same time. All it did what g to the apple logo and went back to recovery mode any help?

    Once the Device is asking to be Restored with iTunes... it is too late to save anything... and you must continue with the Recovery...
    kevinpowell1 wrote:
    how can i get it out of recovery mode?
    Make sure you have the Current Version of iTunes Installed on your computer
    iTunes free download from www.itunes.com/download
    Then See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...  Be sure to Follow ALL the Steps...
    Take your time... Pay particular attention to Steps 3 and 4.
    Some users have reported as many as 8 or 9 attempts were necessary before success.
    After you have Recovered your Device...
    Re-Sync your Content or Restore from the most recent Backup...
    Restore from Backup  >  http://support.apple.com/kb/ht1766
    If the issue persists...
    Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step...
    Be sure to make an appointment first...

  • I have lost my "Basic" panel in the Develop module and can't figure out how to get it back. My right panel goes from the Histogram straight to the Tone Curve panel.  My Basic panel should be below the Histogram.  Any ideas how to get it back.  I have even

    I have lost my "Basic" panel in the Develop module and can't figure out how to get it back. My right panel goes from the Histogram straight to the Tone Curve panel.  My Basic panel should be below the Histogram.  Any ideas how to get it back.  I have even uninstalled my lightroom and reinstalled it with same issue.  Help!!!

    Right click on or near one of the other headers and a pop-up will appear and you will be able to select the Basic Panel for viewing.

  • How to know the full path which is being used in the dataconnection .

    How to know the full path which is being used in the dataconnection without going and looking into coding.
    I am new to crystal reports.
    Plz advice.Thanks in advance
    Jay

    This forum is dedicated to topics related to custom application development or deployment with Crystal Reports in .Net. This includes full versions of Crystal Reports as well as those versions of Crystal Reports bundled with Microsoft Visual Studio .Net.
    As you do not want to do any coding, this query is in the wrong forum. However, in most versions of Crystal Reports, you can look up the database connection information by simply opening the report in the CR designer. Then go to the database menu and select "Set Datasource Location..."
    Ludek

Maybe you are looking for

  • Set up and Sync issues with Windows 7

    I now have a windows 7 computer and cannot seem to find a way to make my Palm m105 set up an sync with my computer. Can someone please guide me to a solution. Thank you Post relates to: Palm m105

  • Issue with Phantom Material in PCE

    Hi, While creating the PCE for one of the finished materials, in the PCE, the phantom material is not getting selected. There is no issue with the production version or BOM or Master recipe since in the process order after the BOM explosion the phant

  • How to display a text field if yes selected in radio button

    Does anyone know how to hide/show a text field based upon a radio button selection? What I want to do is ask a question with yes or no as radio buttons. Then, if the user selects "YES" I want to display a required text field. If the user click no, th

  • Slow motion is distorted on DVD

    When i burn a movie to DVD and watch thorugh a dvd player, the slow motion looks distorted.    have premiere elements 7.  I'm trying to make some highlight sport videos.   What is the best way to burn to DVD and get the best quility.   The slow motio

  • Why won't certain texts go through?

    I have one number in my contact list that keeps getting the red exclamation mark every time I text it.  They used to go through and now they don't.  Anyone know why?