| Author |
How To Read boolean value from a property file
|
Ramakanta Sahoo
Ranch Hand
Joined: Aug 23, 2008
Posts: 228
|
|
Hi All,
I have a small question I have code like below
I want to read the values like true or false from a property file named input.properties instead of hard coding it . How to do it . Can somebody shed some light am confused.
|
Regards, Ricky
Oracle Weblogic 10g Certified Expert
TechBlog
|
 |
Lorand Komaromi
Ranch Hand
Joined: Oct 08, 2009
Posts: 276
|
|
|
Take a look at Boolean.parseBoolean()!
|
OCJP 6 (93%)
|
 |
Ramakanta Sahoo
Ranch Hand
Joined: Aug 23, 2008
Posts: 228
|
|
I am getting a error of
Code:
Executing as java -classpath ./inputs.properties -jar ./myTool.jar blah blah
Please help.
|
 |
Zandis Murāns
Ranch Hand
Joined: Aug 18, 2009
Posts: 174
|
|
|
|
 |
Ramakanta Sahoo
Ranch Hand
Joined: Aug 23, 2008
Posts: 228
|
|
Zandis Murāns wrote:
What Do you mean by this. Can you please make me understand with some example.
|
 |
Zandis Murāns
Ranch Hand
Joined: Aug 18, 2009
Posts: 174
|
|
Yeah, sure.
Create properties file, for example c:\my.properties
In this file define some properties, for example
next, in your java code, create instance of java.utils.Properties class:
fulfil this object with your properties:
Now assign your variables
|
 |
Ramakanta Sahoo
Ranch Hand
Joined: Aug 23, 2008
Posts: 228
|
|
Thanks for the description.
|
 |
 |
|
|
subject: How To Read boolean value from a property file
|
|
|