How to refresh .properties files.

Hi,
I am using Struts 2.0.
Here is my question:
I have admin. section where I have provided facility to change the caption of label displayed at public side.
Name of labels come from .properties file. Now using Property object I access my resourse file & using setProperty() method I have changed value of respective key.
To get conformation that changes are affected I have openned this file & diplayed it on console. Changes are made successfully but when I see the label of public side, they are unchanged (After refreshing web page).
According to my knowledge, when ever application is loaded first contents of .properties file are loaded in memory, so even if we change the file contents, references present in memory are not changed.
Is there any way by which I can refresh memory content.
Since .properties file is change but its change are not affected on memory.
Possible solution for it is that I shall restart my application. Is that possible by programming.
Any other solutions will be appreciated.

Yes,
.properties files is updated perfectly.
One of the thing which I noticed is that when I openned .properties file to check updates and close it, Now I pressed refresh button, Change are found to be made on Browser.
But next time I again made changes but didn't open .properties file & pressed refresh button no changes where made on browser.
So I found that by openning file explicitly change are made in browser,
Keeping this thing in mind I created on File object & displayed entire file on console.
It showed changed file content, but changes are not found on Browser.
So whats exactly happening here?

Similar Messages

  • How to refresh XML file  from my client machine

    Hai All
    I have temp.XML and temp.XSL template in our server machine.
    when i give a print from client machine first time it gives the record,and next time it did not get refresh.Always it shows the previous records in the browser.But when i go into the server machine and click on temp.xml,it shows the current record(correct records)
    How to refresh XML file  from my client machine?
    Regards
    Dhina

    You never delete a Time Machine backup by dragging it to the Trash. You are supposed to use the TM application to manage the backups. What you will need to do now is to simply erase the drive using Disk Utility.

  • How to use properties file

    Hi,
    I want to use properties file in my application. I have kept properties file inside a directory called properties which is inside myProject(which is the parent directory of my project) i.e "myProject/properties".
    My java file where i want to call this properties file is inside the myProject/WEB-INF/src/java.
    How can i call the properties file from myProject/WEB-INF/src/java/PropertyReader.java
    I wrote java program in myProject/WEB-INF/src/java/PropertyReader.java like:::::
    ResourceBundle resBun = ResourceBundle.getBundle("Test", Locale.getDefault()); // Test.properties is inside myProject/properties
    resBun..getString("name");
    After running the program i am getting the following errors:::::
    Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name Test, locale en_US
    at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836)
    at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
    at java.util.ResourceBundle.getBundle(ResourceBundle.java:576)
    at PropertiesReader.main(PropertiesReader.java:4)
    What is the issue? How to use properties file?
    Waiting for reply.
    Thanks

    Still getting same exception. As you explained i tried like the below:::
    1. I am using ant as build tool.
    2. My properties file is for database configuration
    My properties file is::
    database.properties (inside myProject/properties)
    JDBCDriver=org.gjt.mm.mysql.Driver
    JDBCConnectionURL=jdbc:mysql://pmdbmysql:3306/bandwidthshaper?user=admin&password=admin
    My java package structure is
    WEB-INF/src/java
    WEB-INF/src/classes
    For build WEB-INF is the base directory and build.xml is inside the src directory
    In my build.xml i wrote the following lines for compilation::
              <target name="compile" >
                   <javac srcdir="src" destdir="src/classes" debug="true" debuglevel="lines,vars,source">
                        <classpath refid="class.path"/>
                   </javac>
    <copy todir = "src/classes" >
    <fileset dir = "../properties" />
    </copy>
                   <jar jarfile="lib/${project.jar.file}" basedir="src/classes"/>
              </target>
    I am copying properties file to the classes directory.
    Now in java file which is inside /WEB-INF/src/java, I wrote::
    try {
    Properties programProps = new Properties();
    InputStream is = getClass().getResourceAsStream("/database.properties");
    if(is == null)
    throw new IllegalStateException("Properties file missing ");
    programProps.load(is);
    System.out.println("driver name::::::: "+programProps.getProperty("JDBCDriver"));
    is.close();
    } catch(Exception e) {
    e.printStackTrace();
    After compilation in my classes directory i am getting database.properties file and my java file with package.
    At the time of running i am getting "java.lang.IllegalStateException: Properties file missing"
    Now tell me where is the fault. Why again i am getting exception.
    Thanks

  • How to use .properties files in Webdynpro Java code?

    Hi all,
      I want to use a logon.properties file when I initial a JCO connection pool in my webdynpro DC (JCO.addClientPool()),but  I found when I deployed this DC to the server, it always giv e me an FileNotFoundException. So I donot know how to deploy a .properties file to the server and how to access this file in my Java code?
    Thans and Best regards
    Deyang

    Hi,
    1) put .properties file to your packege under src\packages folder (src\packages\com\sdn\properties\jco.properties)
    2) load property:
         final InputStream is = getClass().getClassLoader().getResourceAsStream("com/sdn/properties/jco.properties");
         final Properties properties = new Properties();
         try
              properties.load(is);
         catch(Exception e)
              wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);
    Regatds Maxim R.

  • How to load properties file

    Hello Everyone,
    We are experiencing difficulties when trying to load a properties file from a directory other then the one where the servlet is located. We are using the following code for this purpose:
    private final String PROP_FILE_NAME = "my.properties";
    Properties props = new Properties();
    try {
    props.load(getClass().getResourceAsStream(codeBase + PROP_FILE_NAME));
    } catch(IOException e) {
    //handle error ...
    where codeBase is either physical directory path to the properties file or the URL. In either case we get a NullPointer exception which means that file is not found. But when we copy the properties file into the same directory where the servlet resides, everything works fine.
    Does anybody have an idea as to how to resolve our problem?
    Any help will be greatly appreciated!
    Thanks in advance!
    Y.M.

    HI,
    I always keep my properties in a sub-directory called resources. In this case it is called Aircraft.properties.
    * Holds the ResourceBundle of this object.
         private static ResourceBundle resources;
         static
              try
                   resources = ResourceBundle.getBundle("resources.Aircraft", Locale.getDefault());
              catch (MissingResourceException mre)
                   System.err.println("resources/Aircraft.properties not found");
                   System.exit(1);
    // Here I pick up the data from the properties file
         protected String getResourceString(String nm)
              String str;
              try
                   str = resources.getString(nm);
              catch (MissingResourceException mre)
                   str = null;
              return str;
    // In this case I use menubar as key to my properties
    String[] menuKeys = tokenize(getResourceString("menubar"));
    Hope this will help a bit.
    Klint

  • How can load properties file for one time and use in entire application

    Hi folks,
    I dont want to read properties file every time , and want to get property value in any servelet or jsp page.(means i want to read only property file only for once and want to get value in any where ) , how to do this.
    Message was edited by:
    RajeshwarReddyT

    means we have to read file every time Know but i dont
    want to be happen that ??? No you don't . You read the file once. You store it in the hashmap. Then you hand that hashmap to whatever class needing the data.
    getProperties() returns the hashmap, doesn't read the file.
    Maybe I should have called the method getMap or something.
    Message was edited by:
    karma-9

  • How can configure .properties file and  log4j on weblogic 8.1 SP5

    Hi,
    I know this is not right forum for post this question.But I hope I'll get my perfect answer here.
    I have 2 questions.
    1. Where I'll keep my .properties file in weblogic 8.1 SP 5. means I have one own .properties file which is contains some proxy settings and this .properties resides on .war file(now), But I want move this propeties file outside .war file. So Where I'll keep in weblogic 8.1 SP 5.
    2. How can we configure log4j in weblogic?
    Please reply me.
    Regards,
    Pattanaik

    You can add your.properties and log4j.properties to the classpath cant you?
    You just need to edit setEnv.cmd (if i remember correctly) in your weblogic server folder to add the folder containing the properties files to the classpath variable.

  • How to read properties file?

    hi,all friends,can you tell me how to get information from the properties
              file such as weblogic.properties or
              user defined properties file? And where should I put the properties file?The
              location of properties file
              should not be pre-defined in the source code.I wanna get the location of
              properties file from weblogic.properties .
              Help me and thanks a lot..
              Tony tian
              

              Hi Tony,
              for example in your init() insert such codes:
              Properties props = new Properties();
              FileInputStream fin;
              try {
              fin = new FileInputStream("weblogic.properties");
              props.load(fin);
              fin.close( );
              catch (IOException e) {
              throw new ServletException("blabla:", e);
              and verify the key, say: weblogic.system.bindAddr, you will get a string (exist) or null (non existing). for example:
              String s = props.getProperty("weblogic.system.bindAddr");
              if (s != null) {...} // existed
              else {...} // not existed
              Joe
              "Tony Tian" <[email protected]> wrote:
              >hi,all friends,can you tell me how to get information from the properties
              >file such as weblogic.properties or
              >user defined properties file? And where should I put the properties file?The
              >location of properties file
              >should not be pre-defined in the source code.I wanna get the location of
              >properties file from weblogic.properties .
              >Help me and thanks a lot..
              >Tony tian
              >
              >
              

  • How to read properties file(key-value) in OSB?

    Hi
    I have a scenario in which I have to read some properties(key-value) from a file. Earlier whole code was developed in java and its easy to read properties file in java.
    But now need to implement this in OSB and performance is very critical in this project.
    I followed DVM approached defined in
    http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html and http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html
    But it did not work. I have hundreds of properties(key-value pairs) to read and need pass them to the business service along with input of proxy service.
    What is the best approach for this (Can not go for db call as performance is very critical)?
    Thanks
    Vibhor

    $DVM= <dvm      name="InterfaceProperties" xmlns:ns1="http://xmlns.oracle.com/dvm" xmlns="http://xmlns.oracle.com/dvm">
         <columns>
         <column      name="PROPERTY_KEY" qualifier="false" order="1"/>
         <column      name="PROPERTY_VALUE" qualifier="false" order="1"/>
         </columns>
         <rows>
         <row>
         <cell>dealer.locate.default.buypower.link</cell>
         <cell>http://www.xyz.com</cell>
         </row>
         <row>
         <cell>dealer.locate.default.unitOfMeasure</cell>
         <cell>MILES</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.nu</cell>
         <cell>Nurun</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.bu</cell>
         <cell>Buick</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.ca</cell>
         <cell>Cadillac</cell>
         </row>
    </rows>
    </dvm>
    XPATH is- ns1:dvm/ns1:rows[1]/ns1:row[1]/ns1:cell[1]/text()
    If I run this xpath in Jdeveloper,its giving me proper output.
    Please this as CQuery resource and try to run this xpath on OSB console.
    Thanks
    Vibhor
    Edited by: Vibhor Rastogi on Sep 21, 2010 4:59 AM

  • Refreshing properties files

    Hi
    At the moment any time we make a change to a properties file, we have to restart tomcat for the changes to take effect.
    I'm trying to set up a jsp page which will call the function in the bean which loads the properties file.
    This is the codes we're using:
    in = this.getClass().getResourceAsStream("/pagedata.properties");
    props.load(in);
    in.close();
    It works fine when the the bean is loaded but if I make a change to the properties file and call this function to load the props file again it doesn't work.
    Thanks.

    maybe,in your system,there are more than two property files named 'pagedata.properties' and maybe they are all in directory you classpath points to. And perhaps you change one,but your running program use another.

  • How to read Properties file once and access through the entire application

    HI All,
    I want to read properties file only once and want to access the property file values in entire application (like i want to access it in a ordinary class)

    Please do not double-post. Stick with one thread:
    http://forum.java.sun.com/thread.jspa?messageID=9678612

  • How to refresh JavaScript File.

    I am running JavaScript file on the Folder level.
    Looks like I am still running the previous version
    of the file even after I made corrections to the
    js file.
    Is it any refresh action I can use in the code or
    on the keyboard.
    Is somebody can help with this?
    Thanks.

    There is no refresh. You need to close all instances of Acrobat (including those in the browser) and restart the application. Acrobat only reads through this folder on application initialization.

  • How to refresh .swf file whose source data is only using "EXCEL"

    Can Some one help me out with this please.........
    I developed a dashboard using excel (embedded in xcelsius 2008) and then exported it to .swf file.
    Now when the data changes in .xlf file. I want my swf file to refresh the data.
    Thanks in Advance

    Hi,
       Read the below instructions extracted from KB Article 1424833 and see if it helps
    XML files need to be designed in a specific structure in order to work correctly in Xcelsius 2008. Below are some important conventions:-                                                                               
    1) The XML code should start and end with data tag like <data>...</data>.                                                            
    2) Row and column tags must be used to encapsulate data.                                                                         
    3) Everything is case sensitive.                                                                               
    4) While inserting a range in XML data connection, the range name should be similar to the variable name defined in the XML code.                                                                               
    The xml code should look like this:-                                                                               
    <data>                                                                               
    <variable name="ExampleRange">                                                                               
    <row>                                                                               
    <column> Row1 Column1 value </column>                                                                               
    <column> Row1 Column2 value </column>                                                                               
    <column> Row1 Column3 value </column>                                                                               
    </row>                                                                               
    </variable>                                                                               
    </data>                                                                               
    In Xcelsius, we have to give range name=ExampleRange and then assign the Excel cell to load the data.
    Regards,
    Ken

  • How to refresh php files

    Hello,
    I have one problem I start using Dreamweaver 2004MX, but i
    didnt get to know how can i see my page normal? it will be so nice
    if some one can help me.
    Hope to get your help soon.
    have good time and nice week end.
    sincerly yours
    Thakur

    Hello Jeremy
    What I mean is normally when I use before Dreamweaver for xp,
    I make page than when wanted to view my page as normal by
    refreshing than i could see how it looks.
    Now I am using Mac i am just doing my small page by using
    Mx2004, I refresh my page after i finished some coding but it never
    make change stay same.
    Just I like to ask you how I can see the page as normal not
    with line...and things.
    It will be so helpfulll if i get answer from you.
    Thank you
    Thakur

  • How to load Java properties file dynamically using weblogic server

    Hi,
    We are using Java properties file in Java code. Properties in java properties file are frequently modified. If I keep these properties file in project classpath or as part of war, I will have to redeploy application after each change.
    We are using Weblogic Server.
    Can you please suggest me how can this properties file be loaded at weblogic server startup. Then in that case, how to refer property file in Java code?
    What is the best practice for this?
    Thanks,
    Parshant

    Another alternative is, keep the property file in any pre-defined location. Write a class which reads the properties from the file and returns the one which is requested by caller and deploy this class. Whenever you have to change the properties just update the property file on server and next call to fetch the property should return the updated one.
    Downside of this approach is file I/O everytime. To overcome that you can actually "cache" the properties in a hashmap. Basically when any property if requested, first check the hashmap, if not found then only read from property file and also update in hash map. Next time same property will be returned from hash map itself. The hash map will be cleared at every server restart since its in the memory. You will also need to build a method to clear the hashmap when you update the values in the property file on server.
    This solution would be suitable for small size files and when network overhead of calling a DB needs to be avoided.

Maybe you are looking for

  • Trying to query data from a view - ORA-01882 and ORA-02063 Errors

    Hey there, I tried to query data from a view that was provided by a colleague. This view works fine and gives correct data using PL/SQL Developer or SQLPLUS, but in SQL Developer, I get the following error: ORA-01882: Time zone region not found ORA-0

  • HT5654 a simpler way to fix my ipod touch from being disabled

    i have did the steps of hooking my ipod 4th generation to computer with itunes about 7 times and it still is disabled. I need a simperly way to fix this issue. it will not work with hooking it up to itunes.. I have the newest version and done everyth

  • Problems in tilelist dataprovider

    Hi, I'm newbie in flex. I have a problem in tilelist. How can i call the child node of the xml file? I'm having "ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/getChildIn

  • Action on load???

    I know how to transition from one page to another but can't figure out how to create an action on load of that page.  I would like the "click anywhere" button/text to fade in and out or move back and forth.  I can create a second state in which it wi

  • Graduating scale and condition type pr002

    hi,      I am using the pricing condition pr002 in a sales order.the scales i have maintained is between 0-4 items price shd be 10000 and between 4 to 8 price is 8000.however in sales order with basic price ,discount and freight at first ths conditio