Solved

Reading property file

Posted on 2006-07-13
5
223 Views
Last Modified: 2010-03-31
Hello
I have a property file:

PROP FILE:
Strength = Medium
Day = Thursday

------
I used the following code to read the property file
Properties props = new Properties();
            props.load( fis= new FileInputStream (new File ("file.properties")) );
---------
I just need to check if the "Strength" attribute in properties file is equal to "Medium" (java) and "Day" is equal to "Thursday", How do I check this using java code.

Thank you (Urgent response requested:)            
0
Comment
Question by:atwork2003
  • 3
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17102585
if ("Medium".equals(props.getProperty("Strength")) {
}
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 17102591
Typo

if ("Medium".equals(props.getProperty("Strength"))) {
}
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17102595
try like this:
"Thursday".equals(props.getProperty("Day"));
0
 

Author Comment

by:atwork2003
ID: 17102862
Works. Great...Thanks:-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17103218
:-)
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hibernate example for saving data 19 73
sql import cannot be resolved jsp 3 72
web project error add remove 1 49
Java array 10 55
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question