Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


naveen
Property File
1 Answer(s)      2 years and 6 months ago
Posted in : Java Beginners


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


Advertisement
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();
        }

    }
}


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, it's use and how can we read it via our Java code. What is property file ? A property file is used to store an application's configuration parameters
To read key-value of a given property file - Java Beginners
To read key-value of a given property file   HI, As per the topic "Read the Key-Value of Property File in Java "u provided under "util java examples " I have written a java file and properties file under a package
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
Redefine property in the children Target
to define the property file whether it is local or global. When you create... the message Global file.  The <property name="build.property"... file and <property name="build.property" value="Target"
@property nsinteger
@property nsinteger  Hi, How to declare @property nsinteger? Thanks... myvariable; } @property (nonatomic) NSInteger myvariable; @end Thanks   ...; } @property (nonatomic) NSInteger myvariable; @end Thanks
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
PHP Property Management - PHP
PHP Property Management  PHP Property Management.. any idea
add a property to instance variable
add a property to instance variable  How to add a property to instance variable in iPhone SDK
php array length property
php array length property  How to get the php array length property
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
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 datasource required - Spring
property datasource required  Hi I am using java springs I am using mysql as backend I am getting one error when i compile the application.property datasource required. This is my dispatcher-servlet.xml
Multibox property - Struts
Multibox property  I am trying to implement a multibox property. I get the values for them through a populated VO object from the Server. In the form I have defined two array variables They are Daysoftheweek : contains all
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="
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: Here
Problem With Combo Box Editable Property
Problem With Combo Box Editable Property  Hi I am new To Flex i had set Combo Box Editable Property as true. But I didn't get the property filtering in the combo box like when you enter text "S" in the combo box then the names
JDBC Transaction ACID property
.style1 { text-align: center; } JDBC Transaction ACID Property... property refers to the Atomicity, Consistency, Isolation, Durability respectively. Atomicity- This property says that all the changes to the data
Passing a java property to a javascript variable
Passing a java property to a javascript variable  i want to assign a java property to a js variable: action class: collegename have a property in action class which having its getter/setter method. JSP code: <%@ taglib
Property Tag (Data Tag) Example
Property Tag (Data Tag) Example       In this section, we are going to describe the property tag. The property tag is a generic tag that is used to get the property of a value, which
Pentaho Report Designer connection through Property files
Pentaho Report Designer connection through Property files  Hi, I am using spring MVC and calling the .prpt file through connection string... anyone provide a code where i can pick the connection string directly from property
Spring Set Property
Spring Set Property The Spring Framework has bean support for the Collections. It provide list, set, map and props elements. Here in this tutorial you will see about the set elements which is used to set values inside the set
Spring Map Property
Spring Map Property The Spring Framework has bean support for the Collections. It provide list, set, map and props elements. Here in this tutorial you will see about the map elements which is used to set values inside the map
JSP bean get property
JSP bean get property   ... bean get property. In this example we define a package bean include a class... in JSP page. The JSP page uses bean get property and return the value stored
What are the different types of property and class mappings?
What are the different types of property and class mappings?  Hi, What are the different types of property and class mappings? thanks
Get Property by Name
.style1 { margin-right: 75px; } Get Property by Name      ... to get Property by Name. For this we have a class name "Get Property
How to Assign struts2 property to jsp variable
How to Assign struts2 property to jsp variable  In Struts2 <s:property value='count'/> I wants to assign <% int count = %><s:property value='count'/><% ; %> But its not working.   Please
Advertisements
 

 

 

DMCA.com