Finding files when you develop web program

Hi. I develop web app. I deploy application on GlassFish. I have stateless session bean. There code reads data from file and checks retrieved value. File f= new File("category.properties"); suppose to locate the file category.properties in Project's directory. But the program can't find it there. The file exist in that directory.
Somehow that file was found before in Project's directory and deployed to GlassFish. So I noticed that the program checks just if the file exist on GlassFish, but does not check if the file is in Project's directory. As well the program updates data in file which is inside GlassFish but leaves alone same file in Project's directory.
If you run that class which reads file from Project's directory using separate main method which runs just that class, then the program sees the file in Project's directory and updates it.
How to force the web program to read/find file in Project's directory and if you make updates show those updates in Project's directory file.
Cheers
Edited by: 814861 on 23-Feb-2011 06:26

A deployed application has no relation at all to a 'project'. What you want is the application to find a file in a specific directory.
In your case you will probably only want to read from the file, so your best bet is to put the file on the classpath (for example, put it in the 'classes' subdirectory of your war) and load it using getClass().getClassLoader().getResourceAsStream(). In other words, make the properties file part of your project resources.

Similar Messages

  • I get itunes can't find file when I tried to play a TV show I had purchased that was supposed to be in the cloud. There are several of these, including an entire season. In the store it shows that I purchased these shows when I checked them.

    I get itunes can't find file when I tried to play a TV show I had purchased. I then checked and had this problem with an entire TV season I had purchesed. The shows were supposed to be in the cloud. I went to the itunes store, went to the tv shows and they showed that I had purchesed them. They do not show up when I click on purchesed in the store.

    Try this...
    Empty/corrupt library after upgrade/crash
    Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps you shouldn't lose a thing or need to do any further housekeeping. In the Previous iTunes Libraries folder should be a number of dated iTunes Library files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library.itl as iTunes Library (Corrupt).itl and then rename the restored file as iTunes Library.itl. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
    See iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
    When you get it all working make a backup!
    tt2

  • Where is the file when you export from share to you tube?

    1. where is the file when you export (share) to you tube?
    I want to use the moivie again in another movie or DVD menu or just to save it etc. I cant't find the location after uploading to you tube.
    The only way to this can not be "export to media" or devices and from there to you tube?
    2. Does it make any differances for the quality on you tube wich way you choise?
    thanks, bruce

    Yes, i found it there. In fact; a logic place...
    The second q. means the way you load upo; dirtectly from the menu share to you tube of first make a QT and from there to the sky.
    I quess there must be no differance but you never know...
    Thanks again.

  • HT1461 For Boot Camp, if you save a file when you are on the Windows side, when you return to the Mac side, can you see the file or can it only be "seen" on the operating side you create it in?

    For Boot Camp, if you save a file when you are on the Windows side, when you return to the Mac side, can you see the file or can it only be "seen" on the operating side you create it in?

    Why don't you  (generic most every post lacks critical details) be clear and say you never used Mac OS etc.
    But, I did try to anticipate and give you what you needed.
    Excel is one of those rare programs that, if they are extremely large complex spreadsheets still tend to run better under Office for Windows.
    A VM won't do for that but it does make it easier to transition. As in: install Windows natively, then use VMware Fusion or Parallels to attach to the partition and OS. That way you can run Windows as Guest OS VM under Mac; and still run Windows natively dual-boot when needed.
    The word "see" was not what you wanted, was it? really? you want to open and make changes and keep it on Windows side rather than Save As or copy to Mac
    You use Windows and don't know it has NTFS (NT FileSystem)?
    http://en.wikipedia.org/wiki/NTFS
    http://en.wikipedia.org/wiki/Hierarchical_File_System (HFS) native file system used by Apple
    And there is much more UEFI style "bios" and other things I suppose.
    Great thing about Google and encyclopedias or dictionary, you can look up what you don't know.

  • Can you still access Adobe PDF SAVED FILES WHEN YOU GET A NEW COMPUTER

    Can you still access Adobe PDF SAVED FILES WHEN YOU GET A NEW COMPUTER ? Do you loose the files you have saved on you old computer when you get another computer?

    I may not be clear on what you are asking here but I'll try an answer anyway since that's the type of guy I am.
    If you have PDF files on your old computer, you will need to transfer them to your new computer. You can use a flash drive or CD if needed.
    But again, I think I'm not getting what you are really wanting to know. If I'm not, can you give us some more details?

  • I wanted to know explain my problem down package cc2014 where I put the serial number of the problem that I have is that when you open the program asks me start of session in which he put it and go but back inside and it drives me to request the start of

    I wanted to know explain my problem down package cc2014 where I put the serial number of the problem that I have is that when you open the program asks me start of session in which he put it and go but back inside and it drives me to request the start of session and I take 3 weeks or more with this problem if they can support me solve it was the number of seire wearing this being installed at a private university

    Cloud programs do not use serial numbers... you log in to your paid Cloud account to download & install & activate... you MAY need to log out of the Cloud and restart your computer and log back in to the Cloud for things to work
    Some general information for a Cloud subscription
    Log out of your Cloud account... Restart your computer... Log in to your paid Cloud account
    -Sign in help http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html
    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html
    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html
    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html
    Does your Cloud subscription properly show on your account page?
    If you have more than one email, are you sure you are using the correct Adobe ID?
    https://www.adobe.com/account.html for subscriptions on your Adobe page

  • Is there a way to find exactly when a certain web page was visited? I know if I go to Tools/Page Info, I can see how many times that page was visited, but I would like to know if I can find the exact time and date. Thank you.

    I am using Firefox version 3.6.13

    You can find the last time a web page was visited by using the Library.
    In the History menu select "Show All History" to open the Library. You can use the Library to view the history, and by default it will show the last date & time the site was visited. If the Visit Date column is not visible, within the Library select Views, then Show Columns, then Visit date to display that column.

  • Can't find file when use the main(String[] args) method

    I put a file under the DefaultDomain directory of Weblogic 11.1.1.5 on my local machine. Below is how I look up this file
    FileInputStream fis = new FileInputStream("input.xml");
    I started up the IntegratedWeblogicServer instance and I tested using the below 2 approaches.
    1) When I test a web service program using the below approach, it CAN'T find the input.xml file
    public static void main(String[] args)
    2) When I package it into an EAR file and deploy it onto the server then log into the admin console and use the test client approach then it's able to find the file
    How do I make it so it can find the file using #1 approach?
    Thanks

    That's how relative paths work, and it's nothing particular to Java.
    When you type ls input.xml or dir input.xml does it list the file, or give an error? If it lists the file, then it's in your current directory, and it will work if you run Java from that directory. If it gives an error, then that file is not in your current working directory, and Java won't be able to find it either.

  • Can't find files when building EXE unless the WHOLE codebase is in an auto-populating folder

    I have a project with FPGA (specifically a couple cRIO targets).
    I have a build spec for a PC target, then a target that's set up for Scan Mode, then a couple targets set up for FPGA mode.
    When I try and build the FPGA or Scan Mode targets, I NEED to have the entire code folder (and sub-folders) in an auto-populating folder.
    What's strange is that I manually added the same folder, and then pulled the Top-level VI out so that it was easier to see within the project.  When I did that, I got errors that files were broken and missing.  I then removed that folder and added the same folder as auto-populating and all is well.
    Yes, I was able to make the build work by including debugging, not removing TypeDefs, etc.  This also cause the build to go from 2MB and 30 secodns build time to 50MB + 10 min build time.
    Why si this?  I would like to remove the files for other targets from the Source of each of the targets.  If I do this, I can't build (these are other top-level VIs that are not appropriate on a per target basis).
    Any ideas?

    Hey Jed,
    It sounds like the problem you are having is coming from a file path issue.  When you manually add folders as "Snapshot" the file paths are set and will generate errors if the files are moved.  The autopopulating folder updates file path locations so you don't have those same issues.  Debug mode allows for the file paths to be reassociated, but at the expense of time, and in some cases resources.  Enabling debugging will cause the compilation to take longer.
    You wrote:
    So what I am trying to say is that ALL I did when I removed the auto-populate was to click "Stop Auto Populate" and moved the Top-level VI up one folder level within the project.  This causes it to fail compile (unless debugging is checked).
    This makes complete sense.  By moving ANY VI in a project and not having the folder set to auto-populate or having debugging enabled will cause an error because that VI that you moved isn't where it is supposed to be.  This is the way that projects and the compilation of programs was designed.
    To avoid this, don't move files around after they have been added to the project unless you have folders set to autopopulate, or have debug mode enabled.  When you start shuffling file paths, associations get broken and compilations will fail.
    Ben N.
    Applications Engineering
    Certified LabVIEW Developer

  • Bridge won't open NEF files, when you double click them, using PS CC

    I have installed the latest version of PS CC and the Bridge, but when I go to my Nikon NEF files and double click to open them, they open up in some weird Window Photo Gallery, then I went to the preferences for bridge and reset the settings, and now when you double click on them nothing happens and they don't open at all.  I am using a PC with Windows 7.
    I have posted this question before, I need help, PLEASE

    If you go to the Bridge Preferences>File Type Associations what does it list as the default?
    If it doesn't list Adobe Photoshop CC you can use the Browse button to set it to
    the Photoshop.exe in C:\Program Files\Adobe\Adobe Photoshop CC

  • Moving original files when you use your own folder structure

    I currently maintain my own folder structure (on the HDD) for Aperture to read files from (rather than allow it to create its own complicated structure). Based on what i have seen so far, I understand that Aperture links its project with the HDD folder from where you import images.
    In an instance, where I moved my file from the HDD folder structure, the image still appears in Aperture, but with a yellow question mark, and it does not allow me to edit it. Here I am assuming that since i moved the file from its HDD folder, Aperture is no longer able to locate it. Hence, I have the following queries about moving/ deleting files from my HDD:
    Q1: If I want to move a file from one HDD folder to another, how do I do so without losing its link in Aperture
    Q2: How do I completely delete a file from my HDD using Aperture? Assume here that I have imported it into Aperture but haven't made any changes to it, which means that I have only one version, the master version. Currently, when I delete it in Aperture using 'Delete version', I notice that the file still exists in the HDD folder). Is it that the only way to delete a file is to do so first from Aperture and then use Finder to delete it from the HDD folder? If not, whats the best way.
    Q3: There is another scenario for Q2 - If I have made changes to a file after importing it in Aperture, there are now two versions, master version and edited version. If I want to delete both these files, whats the best way to do so.

    OK let's take a step back here.  In your previous post you wrote asking how to move a file from one folder on your HD to another so that Aperture wouldn't loose track of it. And for that we answered to use File->Relocate Masters. The last two questions concerned deleting images from both Aperture and the HD. And we covered that.
    Now you write:
    f i want to move my master and version files from one project to another (and the corresponding master files too), i should first move the master files using File> Relocate master and then drag-drop the versions from within Aperture. (I usually maintain similar names for my HDD folders and corresponding projects in Aperture, hence if i move the master, then it makes sense to move the versions too).
    Now you're bringing in  moving images in Aperture from one project to another.  What you are saying is correct but bear in mind:
    The library structure inside Aperture is totally independent of the file structure you use to store referenced masters on the HD outside of Aperture.
    Now It is possible to have one mimic the other as you seem to be doing but for all intents and purposes Aperture doesn't care at all how the external file structure appears as long as Aperture knows were the masters are.
    So if you want to move masters INSIDE of Aperture from one project to another you can simply drag the visible image from the source project to the destination project. All versions will come along, versions are coupled to their masters and as such can't be moved independently. Any versions in Albums will continue to point to the master they came from.
    Now if you want to move the master files EXTERNAL to Aperture you need to use the File->Relocate Master command so that Aperture will know were the files are.
    Note: there is another command File->Locate Referenced Files that is used to connect Aperture to its referenced masters if the connection between the two is somehow broken. As for example what would happen if you moved the referenced masters using the finder rather then the Aperture command.
    So you should be good to go, just remember that the two structures, Aperture library and referenced files, are independent and don't really need to be kept in sync. And by doing this you're  making extra work for yourself that isn't really necessary.
    regards

  • Yahoo mail won't download .bmp files when you right click, it saves as html.

    I use yahoo mail and a lot of my groups send pictures imbedded. I can right click and save image with .jpg files, but .bmp files save web pages instead of bitmap. I can use Internet Explorer and save image (as .bmp files) when I right click.
    I'm using Windows XP if that makes a difference.

    go mail.yahoo.com as the login entrance for yahoo mail.

  • How do you prevent deleting files when you log out of an account on a MacBook

    I have set up a new account for my son on my MacBook.  I set parental controls.  It will not allow him to save files when he logs out.  How can I allow him to save files and then keep them when he logs out?

    Selecting all does not help - the issue is I need a table within an incoming email to be moved to excel, edited and then pasted back into a new email. "Select All" picks up the email headers, signatures, any messages around the table etc so that doesn't work. Also, as pointed out above Excel doesn't have a select all feature to get the tables back into the body of an email.
    I just tried again going from Excel into Outlook 2011. No luck. All one column down the left side of the email. All columns are removed and text crammed into one column. Just to check I cut from one Excel document and pasted into another and it retained all formating just fine. It is only in and out of Outlook that seems to be the issue.

  • Are there any additional templates for pages other than those you get when you install the program? If so, where do you find them?

    I am looking for additional templates for iWork, specifically for pages. Does Apple or anyone else have them?

    Yes there are plenty of third-party templates available for iWork applications. Try doing a search on Google or software download pages such as MacUpdate or VersionTracker.
    A few links to get you started:
    http://www.iworkcommunity.com/
    http://www.iworkcommunity.com/
    http://www.google.com/search?client=safari&rls=en&q=iWork+templates&ie=UTF-8&oe= UTF-8
    http://www.macupdate.com/find/mac/pages%20templates

  • Cannot find file when starting jnlp from browser

    First of all, im not a web guru, so sorry for my weak knowledge on that part.
    I have a swing application packed in a war file.
    In the root of war file i put my jnlp, html that links to jnlp, and jar file. (everything created with NetBeans)
    But there is also a directory "data" inside war where i hold some files.
    My application is accessing those files at runtime. (those are save files for my game)
    So, when i start jnlp directly everything is fine, but when i start jnlp through html link, i got error message:
    SEVERE: null
    java.io.FileNotFoundException: data\options.data (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(Unknown Source)
         at java.io.FileInputStream.<init>(Unknown Source)
            ...Java Web Start starts correctly, i can see my first panel of the application, but when i proceed (application tries to load save file), it can not find that file (options.data) obviously.
    How is it possible that everything works fine when i start jnlp directly, and it fails when i start it through the browser?
    What is the problem here?
    Thanks for the help!

    Adoendithas wrote:
    SEVERE: null
    java.io.FileNotFoundException: data\options.data (The system cannot find the path specified)
    Of course the JRE is not going to find a data\options.data on my PC, which is where it will look for it, if your software is running on my PC. Resources for JWS projects must either be available as an URL from the server, or downloaded locally to the user's local file system before they can be used as files. Why it fails to find it on your PC is probably that the 'root path' (the default directory at time of invocation) that is prefixed to data\options.data is different between running it off the local file system, and running from HTML. To say for sure, I would need a lot more information on how you are launching it when 'running locally'.
    A major question here is, does the software merely read the data in options.data, or does it actually need to update (i.e. write to) the options.data?

Maybe you are looking for

  • Vendor Invoice Output to non-SAP Application

    Hello,   We want to send the posting status of Vendor Invoices to a non-SAP application. What is the appropriate output condition type, Message type and IDOC type that we can use? Thanks, Venu

  • Cash Allocation: 1 invoice against multiple receipts

    Hello Guys - Need your expertise on customer invoices. Scenario: We sold our product but the customer will pay us monthly via direct debit. We will invoice the customer once at the start of the contract Then monthly, the customer will pay via direct

  • MRP crtl grp entry for each network

    Hi Experts I have used the feature of creating network for WBS element. Since i need to use the network profile for several plants, i could not default the MRP ctlr group and plant in network profile. Due to this, every time when i assign the first a

  • Forms 9i and NLS_LANG

    I cann't run Forms Developer 9i (9.0.2.7.0) with NLS_LANG=AMERICAN_AMERICA.CL8MSWIN1251 and NLS_LANG=RUSSIAN_CIS.CL8MSWIN1251. I get FRM-91111 and FRM-10039. If NLS_LANG is unset Forms Developer runs, but I cann't use cyrillic text. Help me please. O

  • Importing Raw and JPEG from Canon 5D

    My Canon 5D is set to save images as large JPEGs and Raw files. Aperture will only show thumbnails of, and import only the RAWs. Is this normal? I don't see a preference selection to allow importing all images. Bob