• Post Reply Bookmark Topic Watch Topic
  • New Topic

How To Read boolean value from a property file  RSS feed

 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at Boolean.parseBoolean()!
 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zandis Murāns wrote:


What Do you mean by this. Can you please make me understand with some example.
 
Zandis Murāns
Ranch Hand
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 256
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the description.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!