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



Home Answers Viewqa Development-process Reading duplicate keys from .properties file

Have Programming Question? Ask it here!
 
 
 


Shaik Jelani
Reading duplicate keys from .properties file
1 Answer(s)      5 years and 5 months ago
Posted in : Development process



Advertisement
View Answers

October 7, 2011 at 2:05 PM


Try this . It worked for me .

import java.io.BufferedReader;

import java.io.DataInputStream;

import java.io.FileInputStream;

import java.io.InputStreamReader;

public class Sample {

public static void main(String[] args) {

try {

        FileInputStream fstream = new FileInputStream("C:\\java\\prop\\message.properties");
        DataInputStream in = new DataInputStream(fstream);
        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        String strLine;
        String key[] = null;
        // Read File Line By Line
        while ((strLine = br.readLine()) != null) {
            if (strLine.contains("=")) {
                key = strLine.split("=");
                System.out.println(key[0]);


            } else {
                System.out.println(strLine);
            }
        }
        in.close();
    } catch (Exception e) {
        System.err.println("Error: " + e.getMessage());
    }


Related Tutorials/Questions & Answers:
Reading duplicate keys from .properties file - Development process
Reading duplicate keys from .properties file  Hi, I am reading a .properties file using a basic java program.Though the .properties file will not allow duplicate keys, but still I want to develope a program to identify
reading dropdown values from properties file in jsp
reading dropdown values from properties file in jsp  reading dropdown values from properties file in jsp
Advertisements
Detecting Duplicate Keys
Detecting Duplicate Keys  Detecting Duplicate Keys I have a program... constraint. If the user attempts to insert a duplicate name into the table, I want to display an error message by processing the error code from the database. How
Write Keys and Values to the Properties file in Java
Write Keys and Values to the Properties file in Java.... The program for writing keys and values to the properties file has been mentioned... to write or store the keys and values in properties file list. The OutputStream used
Reading a file from Jar JAVA
Reading a file from Jar JAVA  I have added one excel sheet into a jar file. can anybody tell me how i can read that file. actually when i am running code from eclipse i able to read it but when i am adding that jar file
Reading a file from Jar JAVA
Reading a file from Jar JAVA  I have added one excel sheet into a jar file. can anybody tell me how i can read that file. actually when i am running code from eclipse i able to read it but when i am adding that jar file
Reading string from file timed
Reading string from file timed  So I want to make a file reader/ buffered reader that reads a new line of the textfile, lets say every 30 second. Like it reads the first line, waiting 30 seconds, read the next line and so one
Reading text from image file - Java Beginners
Reading text from image file  How Read text from image file
how to fetch values from .properties to a html file
how to fetch values from .properties to a html file  I have a .properties file with some key value pairs in it. I need to fetch the values from this .properties file into a html file.Please let me know how to do
reading a csv file from a particular row
reading a csv file from a particular row  how to read a csv file from a particular row and storing data to sql server by using jsp servlet
How to write .properties file from jsp
How to write .properties file from jsp  Hi i new to java i stuck here please help me... my problem is "I wrote a class to write the .properties file... to implement/write .properties file from jsp. Regards, Venkatesh Gurram
Reading XML from a File
Reading XML from a File       This Example shows you how to Load Properties from the XML file via... File from where properties are to be loaded. DocumentBuilderFactory dbf
Loading properties from a XML file
Loading properties from a XML file       This Example shows you how to Load properties from a XML... parsers. Some of the methods used for loading properties from a XML file
need to update key , value pair in map from properties file
want the keys and values to be dynamically updated into map. that is i have .properties file where i will update the keys and values whenever needed. i want...need to update key , value pair in map from properties file  I have
initialise array by reading from file - Java Beginners
initialise array by reading from file  Hello, I wnat to know how i would initialise an array by reading a text file, which contains a simple pattern. for example the file may look as shown below, with the star character
Writing to and reading from a binary file in java.
Writing to and reading from a binary file in java.  I have written... the binary file from another program as follows: m_dis = new DataInputStream... work, but the records obtained after reading the binary file are much less than
Write the Keys and Values of the Properties files in Java
will see in the properties file, your inserted keys and values had been inserted...): This method used to insert the keys and values in the properties file. This method... Write the Keys and Values of the Properties files in Java
reading data from excel file and plotting graph
reading data from excel file and plotting graph  I am doing a project using NetBeans in which i have to take input an excel file and then using... at the same time from one excel file using different columns..how can i do that? waiting
jar file not reading input from serial port
jar file not reading input from serial port  i used a coding for getting data from serial port. JOptionbox with "port not found" message is shown when i execute thru jar file. but when i execute thru netbeans, data is received
jar file not reading input from serial port
jar file not reading input from serial port  i used a coding for getting data from serial port. JOptionbox with "port not found" message is shown when i execute thru jar file. but when i execute thru netbeans, data is received
How to read and display data from a .properties file from a jsp page
How to read and display data from a .properties file from a jsp page  I have a .properties file. I have to create a jsp page such that it reads the data from this .properties file and display it in table format. Ex:by using
Properties file in Java
to read key and it's regarding values from the properties file.   ... Properties file in Java       Properties file in Java In this section, you will know
Removing duplicate white spaces from a text file
Removing duplicate white spaces from a text file  ... duplicate white spaces from a specific text file. In this section a program is given... white spaces for removing all duplicate white spaces from the text file
PHP duplicate file - PHP
PHP duplicate file   i wanted to duplicate a PHP file resides in different directory on submission
Get All Keys and Values of the Properties files in Java
how to get all keys and it's values of the properties files in Java. Java provides the features to collection of all keys and values of the properties file... Get All Keys and Values of the Properties files in Java
Get All Keys and Values of the Properties files in Java
Get All Keys and Values of the Properties files in Java... to get all keys and values of the properties files in the Java. This section illustrates the way for getting all keys and corresponding values of the properties
Display non-duplicate words from file
Display non-duplicate words from file In this tutorial, you will learn how to read a text file and display non-duplicate words in ascending order. The given code reads the file and stored the file text into StringBuffer. The buffer
Problem to print from my properties file - Java Server Faces Questions
Problem to print from my properties file  Hi, I am a new user of this site. It is very interesting. So this is my problem: I have a jsp file where i try to print some messages from my properties file but when i execute
Properties file in Java
. The properties file is a simple text file. Properties file contains keys and values for the specific key. Keys of properties file is always on left side and it's value... Properties file in Java      
reading multiple files from a directory and writing them into a single file
reading multiple files from a directory and writing them into a single file... file i get an empty text file can you guide me how to do this: /*this program reads multiple files * from a single directory. */ package elite.tech.com
Java Read username, password and port from properties file
Java Read username, password and port from properties file In this section... the properties file and display the data from the database. Now to load the data from... to a stream or loaded from a stream using the properties file
reading the records from a .xlsx file and storing those records in database table
reading the records from a .xlsx file and storing those records in database table  Here is my requirement, I want to read the records from a .xlsx file and store that records in database table. I tried like this public class
Problem to print from my properties file - Java Server Faces Questions
Problem to print from my properties file  Hi, I am a new user of this site. It is very interesting. So this is my problem: I have a jsp file where i try to print some messages from my properties file but when i execute
Java error reading from file
Java error reading from file       Java error reading file... reading from file. For this we have a class error reading from file. Inside
Java read properties file
files. Now to load the data from the properties file, we have used Properties... Video tutorial of reading properties file in Java. Here is the code...Java read properties file In this section, you will learn how to read
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 from java stand alone application in linux. I don't know how to give path
svg file reading and display
svg file reading and display  i want a sample program for reading and displaying the content of a svg file
Reading a text file in java
Reading a text file in java  What is the code for Reading a text file... in java.io.* package for reading and writing to a file in Java. To learn more about reading text file in Java see the tutorial Read File in Java. Thanks
Problem reading word file
Problem reading word file  Deepak you provide me code for extarcting equation from a word file and also to write in a word file.But when I again want to read preveously created word file(created by your code) it gives an error
struts2 properties file
struts2 properties file  How to set properties file in struts 2 ?   Struts 2 Format Examples Struts 2 Tutorial
Thread for reading txt file
Thread for reading txt file  how to use 3 thread to read 3 txt file? To create three threads for reading the file and three threads for getting the strings out of the queue and printing them. thanks
Writing a Program to calculate Circumference of planets reading from a file and writing to new file.
Writing a Program to calculate Circumference of planets reading from a file... a program to read data from a file. Then use the numerical data within... stumped when it comes to reading the file and writing to a new file. My code
Reading big file in Java
Reading big file in Java  How to read a big text file in Java program?   Hi, Read the complete tutorial at How to read big file line by line in java? Thanks
Properties File IN Struts - Struts
Properties File IN Struts  Can we break a large property file into small pieces? Suppose we have property file whose size is 64 kb .can we break... the detail along with code and also entry about properties into configuration file
Writing a Program to calculate Circumference of planets reading from a file and writing to new file.
Writing a Program to calculate Circumference of planets reading from a file... a program to read data from a file. Then use the numerical data within... it comes to reading the file and writing to a new file. My code is as follows
External file reading in jsp
External file reading in jsp  i have written a jsp page(ReadExt.jsp) in my application which reads a text file content from a system... file. It uses BufferedReader class to read that particular file. <%@ page
External file reading in jsp
External file reading in jsp  i have written a jsp page(ReadExt.jsp) in my application which reads a text file content from a system...; The given code reads the given file. It uses BufferedReader class to read
How to read properties file in Java?
Example program of reading a properties file and then printing the data... the java.util.Properties class for reading a property file in Java program... to value. The java.util.Properties class is used to read the properties file
Reading an excel file into array
Reading an excel file into array  Hi, I'm trying to read in an excel file, search a column for containing key words (entered by a user) and then displaying the matching rows in a table. I'm fairly new to JavaScript. Can anyone
Reading a big file effeciently
Reading a big file effeciently  How to read a large text file quickly without memory error in Java? What is the best method to read a big file very efficiently? Thanks   Hi, Kindly check the program Java Read File
 

 

 

DMCA.com