Property File

Property File

how to store key & values pair in property file? Note: In property file keys should be displayed in ascending order. please reply the answer as soon as possible. Thanking You

View Answers

March 14, 2012 at 4:43 PM

import java.io.*;
import java.util.*;

public class WritePropertiesFile {
    public static void main(String[] args) {
        try {
            Properties properties = new Properties();
            properties.setProperty("Natinal-Animal", "Tiger");
            properties.setProperty("Natinal-Flower", "Lotus");
            properties.setProperty("National-Bird", "Peacock");

            File file = new File("file.properties");
            FileOutputStream fos = new FileOutputStream(file);
            properties.store(fos, "");
            fos.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}

Ads









Related Tutorials/Questions & Answers:
Property File
Property File  how to store key & values pair in property file? Note: In property file keys should be displayed in ascending order. please reply..."); properties.setProperty("National-Bird", "Peacock"); File file = new File
struts property file query
struts property file query  hi i hav 3 property file in my struts2 application. how can i tell my struts application to read a particular property file based on the language i select from the dropdown list. Please help
Advertisements
Read Property file From Jmeter
Read Property file From Jmeter  Hi, I am running web driver script from Jmeter, but while reading property file I am getting "File Not Find Exception". Please tell me how to read ".properties" file from Jmeter
Java Property File
Java Property File This section contains the detail about property file... file ? A property file is used to store an application's configuration... languages. Property file store pair of string as key-value pair. Key store
Reading the data from property file from java stand alone application in linux
Reading the data from property file from java stand alone application in linux  Please send me the example of reading the data from a property file... of a property file while creating FileInputStream object. Please send me the answer
I need jsp code for how to write text field value into property file.
I need jsp code for how to write text field value into property file.  Hi , I need to set the text field value into property file using jsp code... ,then the value should be stored in the property file like Username = Valar
@property nsinteger
@property nsinteger  Hi, How to declare @property nsinteger? Thanks... myvariable; } @property (nonatomic) NSInteger myvariable; @end Thanks   ...; } @property (nonatomic) NSInteger myvariable; @end Thanks
hibernate.archive.autodetection property
hibernate.archive.autodetection property in my Hibernate based project? It will be great... use the hibernate.archive.autodetection property and set it to true. The hibernate.archive.autodetection property is used to scan for annotated classes
Spring Date Property
Spring Date Property Passing a date format in the bean property is not allowed and to do so you need to declare a dateFormat bean and reference it as factory bean from its date property that is set in bean property
add a property to instance variable
add a property to instance variable  How to add a property to instance variable in iPhone SDK
How to read properties file in Java?
the java.util.Properties class for reading a property file in Java program... extensions. Here is example of property file: name=Rose India address=Rohini, Delhi.... Here is the video tutorial of reading a property file in Java: "How
ModuleNotFoundError: No module named 'property'
ModuleNotFoundError: No module named 'property'  Hi, My Python... 'property' How to remove the ModuleNotFoundError: No module named 'property... to install padas library. You can install property python with following
property in javascript get set
property in javascript get set  How to create the get and set property in JavaScript?   Creating Get and Set properties in JavaScript example.. myVar Sample = { nval : "", get get() { return this.nval; }, set
property name= hibernate.archive.autodetection
property name= hibernate.archive.autodetection  Hi, How to set the property name= hibernate.archive.autodetection in my Hibernate project. Can anyone give me some code? Thanks   Hi, If you want to use this property
iphone property list related
iphone property list related  question related to iphone application...... how to retrieve data from plist and again check the condition if data is found in plist then go to next view and print those value in table
property hibernate.cache.region.factory_class is not given
property hibernate.cache.region.factory_class is not given  Hi, I have a web application using Hibernate and Spring. At startup it gives following error: property hibernate.cache.region.factory_class is not give Stack trace
Struts2.2.1 property Tag Example
the property Tag in the Struts2.2.1 -- First we create a JSP file named PropertyTag.jsp...Struts2.2.1 property Tag Example The property tag is a generic tag that is used to get the property of a value, which will default to the top of the stack
SPEL-System Property
Accessing System Property Using SpEL Spring 3 provides powerful Expression...: The MyClass class contains property named "prop" which is of String...;spel.systemproperty.MyClass"> <property name="prop" value="
ModuleNotFoundError: No module named 'async-property'
ModuleNotFoundError: No module named 'async-property'  Hi, My... named 'async-property' How to remove the ModuleNotFoundError: No module named 'async-property' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'attr-property'
ModuleNotFoundError: No module named 'attr-property'  Hi, My... 'attr-property' How to remove the ModuleNotFoundError: No module named 'attr-property' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'attr-property'
ModuleNotFoundError: No module named 'attr-property'  Hi, My... 'attr-property' How to remove the ModuleNotFoundError: No module named 'attr-property' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cached-property'
ModuleNotFoundError: No module named 'cached-property'  Hi, My... named 'cached-property' How to remove the ModuleNotFoundError: No module named 'cached-property' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cached-property'
ModuleNotFoundError: No module named 'cached-property'  Hi, My... named 'cached-property' How to remove the ModuleNotFoundError: No module named 'cached-property' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'class-property'
ModuleNotFoundError: No module named 'class-property'  Hi, My... named 'class-property' How to remove the ModuleNotFoundError: No module named 'class-property' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'class-property'
ModuleNotFoundError: No module named 'class-property'  Hi, My... named 'class-property' How to remove the ModuleNotFoundError: No module named 'class-property' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'delegate-property'
ModuleNotFoundError: No module named 'delegate-property'  Hi, My... named 'delegate-property' How to remove the ModuleNotFoundError: No module named 'delegate-property' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'fallback-property'
ModuleNotFoundError: No module named 'fallback-property'  Hi, My... named 'fallback-property' How to remove the ModuleNotFoundError: No module named 'fallback-property' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'fallback-property'
ModuleNotFoundError: No module named 'fallback-property'  Hi, My... named 'fallback-property' How to remove the ModuleNotFoundError: No module named 'fallback-property' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'kim-property'
ModuleNotFoundError: No module named 'kim-property'  Hi, My Python... 'kim-property' How to remove the ModuleNotFoundError: No module named 'kim-property' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'lazy-property'
ModuleNotFoundError: No module named 'lazy-property'  Hi, My... 'lazy-property' How to remove the ModuleNotFoundError: No module named 'lazy-property' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'lazy-property'
ModuleNotFoundError: No module named 'lazy-property'  Hi, My... 'lazy-property' How to remove the ModuleNotFoundError: No module named 'lazy-property' error? Thanks   Hi, In your python

Ads